whio-api-sdk 1.0.193-bet-staging → 1.0.195-beta-staging
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/sdk/modules/agent.module.d.ts +17 -0
- package/dist/src/sdk/modules/agent.module.js +93 -0
- package/dist/src/sdk/modules/audio.module.d.ts +31 -0
- package/dist/src/sdk/modules/audio.module.js +147 -0
- package/dist/src/sdk/modules/auth.module.d.ts +9 -0
- package/dist/src/sdk/modules/auth.module.js +59 -0
- package/dist/src/sdk/modules/base-client.d.ts +25 -0
- package/dist/src/sdk/modules/base-client.js +183 -0
- package/dist/src/sdk/modules/debug.module.d.ts +20 -0
- package/dist/src/sdk/modules/debug.module.js +54 -0
- package/dist/src/sdk/modules/external-integration.module.d.ts +9 -0
- package/dist/src/sdk/modules/external-integration.module.js +38 -0
- package/dist/src/sdk/modules/log.module.d.ts +63 -0
- package/dist/src/sdk/modules/log.module.js +222 -0
- package/dist/src/sdk/modules/organization.module.d.ts +13 -0
- package/dist/src/sdk/modules/organization.module.js +60 -0
- package/dist/src/sdk/modules/session.module.d.ts +16 -0
- package/dist/src/sdk/modules/session.module.js +58 -0
- package/dist/src/sdk/modules/team.module.d.ts +13 -0
- package/dist/src/sdk/modules/team.module.js +72 -0
- package/dist/src/sdk/modules/template.module.d.ts +33 -0
- package/dist/src/sdk/modules/template.module.js +240 -0
- package/dist/src/sdk/modules/user.module.d.ts +17 -0
- package/dist/src/sdk/modules/user.module.js +104 -0
- package/dist/src/sdk/modules/workflow.module.d.ts +10 -0
- package/dist/src/sdk/modules/workflow.module.js +53 -0
- package/dist/src/sdk/sdk.d.ts +169 -211
- package/dist/src/sdk/sdk.js +385 -869
- package/dist/src/sdk/sdk.old.d.ts +222 -0
- package/dist/src/sdk/sdk.old.js +1238 -0
- package/dist/src/sdk/types/agent.types.d.ts +51 -0
- package/dist/src/sdk/types/agent.types.js +1 -0
- package/dist/src/sdk/types/audio.types.d.ts +72 -0
- package/dist/src/sdk/types/audio.types.js +8 -0
- package/dist/src/sdk/types/auth.types.d.ts +21 -0
- package/dist/src/sdk/types/auth.types.js +1 -0
- package/dist/src/sdk/types/common.types.d.ts +20 -0
- package/dist/src/sdk/types/common.types.js +9 -0
- package/dist/src/sdk/types/external-integration.types.d.ts +31 -0
- package/dist/src/sdk/types/external-integration.types.js +1 -0
- package/dist/src/sdk/types/index.d.ts +12 -0
- package/dist/src/sdk/types/index.js +13 -0
- package/dist/src/sdk/types/log.types.d.ts +61 -0
- package/dist/src/sdk/types/log.types.js +1 -0
- package/dist/src/sdk/types/organization.types.d.ts +42 -0
- package/dist/src/sdk/types/organization.types.js +6 -0
- package/dist/src/sdk/types/session.types.d.ts +54 -0
- package/dist/src/sdk/types/session.types.js +1 -0
- package/dist/src/sdk/types/team.types.d.ts +39 -0
- package/dist/src/sdk/types/team.types.js +1 -0
- package/dist/src/sdk/types/template.types.d.ts +118 -0
- package/dist/src/sdk/types/template.types.js +1 -0
- package/dist/src/sdk/types/user.types.d.ts +41 -0
- package/dist/src/sdk/types/user.types.js +1 -0
- package/dist/src/sdk/types/workflow.types.d.ts +19 -0
- package/dist/src/sdk/types/workflow.types.js +1 -0
- package/dist/src/sdk/types.d.ts +1 -517
- package/dist/src/sdk/types.js +2 -23
- package/dist/src/sdk/types.old.d.ts +517 -0
- package/dist/src/sdk/types.old.js +23 -0
- package/dist/src/sdk/urls.d.ts +1 -0
- package/dist/src/sdk/urls.js +2 -0
- package/package.json +1 -1
- package/src/sdk/modules/agent.module.ts +74 -0
- package/src/sdk/modules/audio.module.ts +131 -0
- package/src/sdk/modules/auth.module.ts +53 -0
- package/src/sdk/modules/base-client.ts +214 -0
- package/src/sdk/modules/debug.module.ts +44 -0
- package/src/sdk/modules/external-integration.module.ts +50 -0
- package/src/sdk/modules/log.module.ts +213 -0
- package/src/sdk/modules/organization.module.ts +43 -0
- package/src/sdk/modules/session.module.ts +41 -0
- package/src/sdk/modules/team.module.ts +55 -0
- package/src/sdk/modules/template.module.ts +242 -0
- package/src/sdk/modules/user.module.ts +89 -0
- package/src/sdk/modules/workflow.module.ts +39 -0
- package/src/sdk/sdk.old.ts +1312 -0
- package/src/sdk/sdk.ts +401 -1089
- package/src/sdk/types/agent.types.ts +65 -0
- package/src/sdk/types/audio.types.ts +89 -0
- package/src/sdk/types/auth.types.ts +29 -0
- package/src/sdk/types/common.types.ts +26 -0
- package/src/sdk/types/external-integration.types.ts +37 -0
- package/src/sdk/types/index.ts +13 -0
- package/src/sdk/types/log.types.ts +68 -0
- package/src/sdk/types/organization.types.ts +55 -0
- package/src/sdk/types/session.types.ts +63 -0
- package/src/sdk/types/team.types.ts +48 -0
- package/src/sdk/types/template.types.ts +142 -0
- package/src/sdk/types/user.types.ts +50 -0
- package/src/sdk/types/workflow.types.ts +26 -0
- package/src/sdk/types.old.ts +649 -0
- package/src/sdk/types.ts +2 -649
- package/src/sdk/urls.ts +3 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseClient } from './base-client';
|
|
2
|
+
import { Agent, AgentSettings, CreateAgentSettingsDto, UpdateAgentSettingsDto } from '../types';
|
|
3
|
+
export declare class AgentModule extends BaseClient {
|
|
4
|
+
createAgent(name: string, templateTextReplacement?: string): Promise<Agent>;
|
|
5
|
+
getAgents(): Promise<Agent[]>;
|
|
6
|
+
getAgent(id: string): Promise<Agent>;
|
|
7
|
+
updateAgent(id: string, name: string, templateTextReplacement?: string): Promise<Agent>;
|
|
8
|
+
deleteAgent(id: string): Promise<void>;
|
|
9
|
+
addAgentToOrganization(agentId: string, organizationId: string): Promise<void>;
|
|
10
|
+
removeAgentFromOrganization(agentId: string, organizationId: string): Promise<void>;
|
|
11
|
+
createAgentSettings(settingsData: CreateAgentSettingsDto): Promise<AgentSettings>;
|
|
12
|
+
getAgentSettings(organizationId?: string, agentId?: string): Promise<AgentSettings[]>;
|
|
13
|
+
getAgentSettingsById(id: string): Promise<AgentSettings>;
|
|
14
|
+
getAgentSettingsByAgentAndOrganization(agentId: string, organizationId: string): Promise<AgentSettings>;
|
|
15
|
+
updateAgentSettings(id: string, settingsData: UpdateAgentSettingsDto): Promise<AgentSettings>;
|
|
16
|
+
deleteAgentSettings(id: string): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { BaseClient } from './base-client';
|
|
11
|
+
import urls from '../urls';
|
|
12
|
+
export class AgentModule extends BaseClient {
|
|
13
|
+
// ======================
|
|
14
|
+
// AGENT METHODS
|
|
15
|
+
// ======================
|
|
16
|
+
createAgent(name, templateTextReplacement) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const dto = { name, templateTextReplacement };
|
|
19
|
+
return this.request(urls.agents, 'POST', dto);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
getAgents() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return this.request(urls.agents, 'GET');
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
getAgent(id) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return this.request(`${urls.agents}/${id}`, 'GET');
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
updateAgent(id, name, templateTextReplacement) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const dto = { name, templateTextReplacement };
|
|
35
|
+
return this.request(`${urls.agents}/${id}`, 'PATCH', dto);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
deleteAgent(id) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
yield this.request(`${urls.agents}/${id}`, 'DELETE');
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
addAgentToOrganization(agentId, organizationId) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
yield this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'POST');
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
removeAgentFromOrganization(agentId, organizationId) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
yield this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'DELETE');
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// ======================
|
|
54
|
+
// AGENT SETTINGS METHODS
|
|
55
|
+
// ======================
|
|
56
|
+
createAgentSettings(settingsData) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return this.request(urls.agentSettings, 'POST', settingsData);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
getAgentSettings(organizationId, agentId) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const params = new URLSearchParams();
|
|
64
|
+
if (organizationId)
|
|
65
|
+
params.append('organizationId', organizationId);
|
|
66
|
+
if (agentId)
|
|
67
|
+
params.append('agentId', agentId);
|
|
68
|
+
const queryString = params.toString();
|
|
69
|
+
const endpoint = queryString ? `${urls.agentSettings}?${queryString}` : urls.agentSettings;
|
|
70
|
+
return this.request(endpoint, 'GET');
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
getAgentSettingsById(id) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
return this.request(`${urls.agentSettings}/${id}`, 'GET');
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
getAgentSettingsByAgentAndOrganization(agentId, organizationId) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
return this.request(`${urls.agentSettings}/agent/${agentId}/organization/${organizationId}`, 'GET');
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
updateAgentSettings(id, settingsData) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
return this.request(`${urls.agentSettings}/${id}`, 'PATCH', settingsData);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
deleteAgentSettings(id) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
yield this.request(`${urls.agentSettings}/${id}`, 'DELETE');
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseClient } from './base-client';
|
|
2
|
+
import { AudioFile, UpdateAudioFileDto, Base64AudioFile, CreateBase64AudioFileDto, UpdateBase64AudioFileDto, AddBase64ChunkResponse } from '../types';
|
|
3
|
+
export declare class AudioModule extends BaseClient {
|
|
4
|
+
uploadAudioFileToSession(sessionId: string, file: File | Blob, fileName?: string, culturalTranscription?: string): Promise<AudioFile>;
|
|
5
|
+
uploadAudioFileWithTranscriptionQueue(sessionId: string, file: File | Blob, options?: {
|
|
6
|
+
fileName?: string;
|
|
7
|
+
culturalTranscription?: string;
|
|
8
|
+
}): Promise<AudioFile>;
|
|
9
|
+
getMyAudioFiles(): Promise<AudioFile[]>;
|
|
10
|
+
getAllAudioFiles(): Promise<AudioFile[]>;
|
|
11
|
+
getOrganizationAudioFiles(): Promise<AudioFile[]>;
|
|
12
|
+
getAudioFilesBySession(sessionId: string): Promise<AudioFile[]>;
|
|
13
|
+
getAudioFile(id: string): Promise<AudioFile>;
|
|
14
|
+
updateAudioFile(id: string, updates: UpdateAudioFileDto): Promise<AudioFile>;
|
|
15
|
+
deleteAudioFile(id: string): Promise<void>;
|
|
16
|
+
downloadAudioFile(id: string): Promise<Blob>;
|
|
17
|
+
downloadAudioFileAsUrl(id: string): Promise<string>;
|
|
18
|
+
getTranscribedAudioFiles(): Promise<AudioFile[]>;
|
|
19
|
+
getProcessingAudioFiles(): Promise<AudioFile[]>;
|
|
20
|
+
getFailedAudioFiles(): Promise<AudioFile[]>;
|
|
21
|
+
createBase64AudioFile(dto: CreateBase64AudioFileDto): Promise<Base64AudioFile>;
|
|
22
|
+
getAllBase64AudioFiles(): Promise<Base64AudioFile[]>;
|
|
23
|
+
getBase64AudioFilesBySession(sessionId: string): Promise<Base64AudioFile[]>;
|
|
24
|
+
getBase64AudioFile(id: string): Promise<Base64AudioFile>;
|
|
25
|
+
updateBase64AudioFile(id: string, updates: UpdateBase64AudioFileDto): Promise<Base64AudioFile>;
|
|
26
|
+
deleteBase64AudioFile(id: string): Promise<void>;
|
|
27
|
+
addBase64Chunk(sessionId: string, base64Chunks: string[]): Promise<AddBase64ChunkResponse>;
|
|
28
|
+
queueSessionBase64AudioForTranscription(sessionId: string): Promise<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { BaseClient } from './base-client';
|
|
11
|
+
import { AudioFileStatus, } from '../types';
|
|
12
|
+
import urls from '../urls';
|
|
13
|
+
export class AudioModule extends BaseClient {
|
|
14
|
+
// ======================
|
|
15
|
+
// AUDIO FILE METHODS
|
|
16
|
+
// ======================
|
|
17
|
+
uploadAudioFileToSession(sessionId, file, fileName, culturalTranscription) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const formData = new FormData();
|
|
20
|
+
formData.append('file', file, fileName);
|
|
21
|
+
if (culturalTranscription) {
|
|
22
|
+
formData.append('cultural_transcription', culturalTranscription);
|
|
23
|
+
}
|
|
24
|
+
return this.fileUploadRequest(`${urls.audioFiles}/upload/${sessionId}`, formData);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
uploadAudioFileWithTranscriptionQueue(sessionId, file, options) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const formData = new FormData();
|
|
30
|
+
formData.append('file', file, options === null || options === void 0 ? void 0 : options.fileName);
|
|
31
|
+
if (options === null || options === void 0 ? void 0 : options.culturalTranscription) {
|
|
32
|
+
formData.append('cultural_transcription', options.culturalTranscription);
|
|
33
|
+
}
|
|
34
|
+
return this.fileUploadRequest(`${urls.audioFiles}/upload/${sessionId}`, formData);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getMyAudioFiles() {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return this.request(`${urls.audioFiles}/my-files`, 'GET');
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
getAllAudioFiles() {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return this.request(`${urls.audioFiles}/all`, 'GET');
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
getOrganizationAudioFiles() {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
return this.request(`${urls.audioFiles}/organization`, 'GET');
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
getAudioFilesBySession(sessionId) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return this.request(`${urls.audioFiles}/session/${sessionId}`, 'GET');
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
getAudioFile(id) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return this.request(`${urls.audioFiles}/${id}`, 'GET');
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
updateAudioFile(id, updates) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
return this.request(`${urls.audioFiles}/${id}`, 'PATCH', updates);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
deleteAudioFile(id) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
yield this.request(`${urls.audioFiles}/${id}`, 'DELETE');
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
downloadAudioFile(id) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
return this.downloadRequest(`${urls.audioFiles}/${id}/download`);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
downloadAudioFileAsUrl(id) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const blob = yield this.downloadAudioFile(id);
|
|
80
|
+
return URL.createObjectURL(blob);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// ======================
|
|
84
|
+
// TRANSCRIPTION QUEUE HELPER METHODS
|
|
85
|
+
// ======================
|
|
86
|
+
getTranscribedAudioFiles() {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const audioFiles = yield this.getMyAudioFiles();
|
|
89
|
+
return audioFiles.filter(file => file.status === AudioFileStatus.TRANSCRIBED && file.transcription);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
getProcessingAudioFiles() {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const audioFiles = yield this.getMyAudioFiles();
|
|
95
|
+
return audioFiles.filter(file => file.status === AudioFileStatus.PROCESSING);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
getFailedAudioFiles() {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const audioFiles = yield this.getMyAudioFiles();
|
|
101
|
+
return audioFiles.filter(file => file.status === AudioFileStatus.FAILED);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
// ======================
|
|
105
|
+
// BASE64 AUDIO FILE METHODS
|
|
106
|
+
// ======================
|
|
107
|
+
createBase64AudioFile(dto) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
return this.request(`${urls.audioFiles}/base64`, 'POST', dto);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
getAllBase64AudioFiles() {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
return this.request(`${urls.audioFiles}/base64/all`, 'GET');
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
getBase64AudioFilesBySession(sessionId) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
return this.request(`${urls.audioFiles}/base64/session/${sessionId}`, 'GET');
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
getBase64AudioFile(id) {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
return this.request(`${urls.audioFiles}/base64/${id}`, 'GET');
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
updateBase64AudioFile(id, updates) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
return this.request(`${urls.audioFiles}/base64/${id}`, 'PATCH', updates);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
deleteBase64AudioFile(id) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
yield this.request(`${urls.audioFiles}/base64/${id}`, 'DELETE');
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
addBase64Chunk(sessionId, base64Chunks) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
return this.request(`${urls.audioFiles}/base64/add-chunk/${sessionId}`, 'POST', { base64Chunks });
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
queueSessionBase64AudioForTranscription(sessionId) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
return this.request(`${urls.audioFiles}/session/${sessionId}/transcribe`, 'POST');
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseClient } from './base-client';
|
|
2
|
+
import { LoginCredentials, LoginResponse, PasswordChangeResponse, User } from '../types';
|
|
3
|
+
export declare class AuthModule extends BaseClient {
|
|
4
|
+
login(credentials: LoginCredentials): Promise<LoginResponse>;
|
|
5
|
+
logout(): Promise<void>;
|
|
6
|
+
getProfile(): Promise<User>;
|
|
7
|
+
changePassword(currentPassword: string, newPassword: string): Promise<PasswordChangeResponse>;
|
|
8
|
+
adminChangePassword(userId: string, newPassword: string): Promise<PasswordChangeResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { BaseClient } from './base-client';
|
|
11
|
+
import urls from '../urls';
|
|
12
|
+
export class AuthModule extends BaseClient {
|
|
13
|
+
login(credentials) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
const response = yield this.request('/auth/login', 'POST', credentials, {}, true);
|
|
17
|
+
this.accessToken = response.access_token;
|
|
18
|
+
this.refreshToken = response.refresh_token;
|
|
19
|
+
this.user = response.user;
|
|
20
|
+
yield this.storage.setItem('access_token', JSON.stringify(response.access_token));
|
|
21
|
+
yield this.storage.setItem('refresh_token', JSON.stringify(response.refresh_token));
|
|
22
|
+
yield this.storage.setItem('user', JSON.stringify(response.user));
|
|
23
|
+
return response;
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
yield this.clearAuth();
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
logout() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
yield this.clearAuth();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
getProfile() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return this.request(urls.profile, 'GET');
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
changePassword(currentPassword, newPassword) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const dto = {
|
|
44
|
+
currentPassword,
|
|
45
|
+
newPassword,
|
|
46
|
+
};
|
|
47
|
+
return this.request(urls.changePassword, 'PATCH', dto);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
adminChangePassword(userId, newPassword) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const dto = {
|
|
53
|
+
userId,
|
|
54
|
+
newPassword,
|
|
55
|
+
};
|
|
56
|
+
return this.request(urls.adminChangePassword, 'PATCH', dto);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SDKConfig, User } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Base HTTP client for making authenticated requests
|
|
4
|
+
*/
|
|
5
|
+
export declare class BaseClient {
|
|
6
|
+
protected baseUrl: string;
|
|
7
|
+
protected storage: SDKConfig['storage'];
|
|
8
|
+
protected accessToken: string | null;
|
|
9
|
+
protected refreshToken: string | null;
|
|
10
|
+
protected user: User | null;
|
|
11
|
+
constructor(config?: SDKConfig);
|
|
12
|
+
protected initialize(): Promise<void>;
|
|
13
|
+
fetchConfig(url: string): Promise<void>;
|
|
14
|
+
protected getToken(): Promise<void>;
|
|
15
|
+
protected request<T>(endpoint: string, method?: string, body?: any, headers?: Record<string, string>, noToken?: boolean): Promise<T>;
|
|
16
|
+
protected fileUploadRequest<T>(endpoint: string, body?: FormData, headers?: Record<string, string>): Promise<T>;
|
|
17
|
+
protected downloadRequest(endpoint: string): Promise<Blob>;
|
|
18
|
+
protected clearAuth(): Promise<void>;
|
|
19
|
+
protected isTokenExpired(token: string, bufferMinutes?: number): boolean;
|
|
20
|
+
protected refreshAccessToken(): Promise<void>;
|
|
21
|
+
isAuthenticated(): boolean;
|
|
22
|
+
getCurrentUser(): User | null;
|
|
23
|
+
getAccessToken(): string | null;
|
|
24
|
+
getRefreshToken(): string | null;
|
|
25
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jwtDecode } from 'jwt-decode';
|
|
11
|
+
/**
|
|
12
|
+
* Base HTTP client for making authenticated requests
|
|
13
|
+
*/
|
|
14
|
+
export class BaseClient {
|
|
15
|
+
constructor(config = {}) {
|
|
16
|
+
this.accessToken = null;
|
|
17
|
+
this.refreshToken = null;
|
|
18
|
+
this.user = null;
|
|
19
|
+
this.baseUrl = config.baseUrl || '/api';
|
|
20
|
+
this.storage = config.storage;
|
|
21
|
+
this.initialize();
|
|
22
|
+
}
|
|
23
|
+
initialize() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const accessToken = yield this.storage.getItem('access_token');
|
|
26
|
+
const refreshToken = yield this.storage.getItem('refresh_token');
|
|
27
|
+
const userString = yield this.storage.getItem('user');
|
|
28
|
+
this.user = userString ? JSON.parse(userString) : null;
|
|
29
|
+
this.accessToken = accessToken ? JSON.parse(accessToken) : null;
|
|
30
|
+
this.refreshToken = refreshToken ? JSON.parse(refreshToken) : null;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
fetchConfig(url) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const response = yield fetch(url);
|
|
36
|
+
if (!response.ok) {
|
|
37
|
+
throw new Error(`Failed to fetch config from ${url}`);
|
|
38
|
+
}
|
|
39
|
+
const conf = yield response.json();
|
|
40
|
+
this.baseUrl = conf.baseUrl || this.baseUrl;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
getToken() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const accessToken = yield this.storage.getItem('access_token');
|
|
46
|
+
this.accessToken = accessToken ? JSON.parse(accessToken) : null;
|
|
47
|
+
if (!this.accessToken) {
|
|
48
|
+
throw new Error('Access token not found');
|
|
49
|
+
}
|
|
50
|
+
if (this.isTokenExpired(this.accessToken)) {
|
|
51
|
+
if (this.refreshToken) {
|
|
52
|
+
yield this.refreshAccessToken();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
throw new Error('Access token expired and no refresh token available');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
request(endpoint, method = 'GET', body, headers = {}, noToken = false) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const url = `${this.baseUrl}${endpoint}`;
|
|
63
|
+
const defaultHeaders = {
|
|
64
|
+
'Content-Type': 'application/json',
|
|
65
|
+
'ngrok-skip-browser-warning': 'true'
|
|
66
|
+
};
|
|
67
|
+
if (noToken) {
|
|
68
|
+
defaultHeaders['Authorization'] = '';
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
yield this.getToken();
|
|
72
|
+
}
|
|
73
|
+
if (this.accessToken) {
|
|
74
|
+
defaultHeaders['Authorization'] = `Bearer ${this.accessToken}`;
|
|
75
|
+
}
|
|
76
|
+
const response = yield fetch(url, {
|
|
77
|
+
method,
|
|
78
|
+
headers: Object.assign(Object.assign({}, defaultHeaders), headers),
|
|
79
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
80
|
+
});
|
|
81
|
+
if (!response.ok) {
|
|
82
|
+
const errorData = yield response.json().catch(() => ({}));
|
|
83
|
+
throw new Error(errorData.message || `Request failed with status ${response.status}`);
|
|
84
|
+
}
|
|
85
|
+
return response.json();
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
fileUploadRequest(endpoint, body, headers = {}) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const url = `${this.baseUrl}${endpoint}`;
|
|
91
|
+
const defaultHeaders = {
|
|
92
|
+
'ngrok-skip-browser-warning': 'true'
|
|
93
|
+
};
|
|
94
|
+
if (this.accessToken) {
|
|
95
|
+
defaultHeaders['Authorization'] = `Bearer ${this.accessToken}`;
|
|
96
|
+
}
|
|
97
|
+
const response = yield fetch(url, {
|
|
98
|
+
method: 'POST',
|
|
99
|
+
headers: Object.assign(Object.assign({}, defaultHeaders), headers),
|
|
100
|
+
body,
|
|
101
|
+
});
|
|
102
|
+
if (!response.ok) {
|
|
103
|
+
const errorData = yield response.json().catch(() => ({}));
|
|
104
|
+
throw new Error(errorData.message || `Request failed with status ${response.status}`);
|
|
105
|
+
}
|
|
106
|
+
return response.json();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
downloadRequest(endpoint) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
const url = `${this.baseUrl}${endpoint}`;
|
|
112
|
+
yield this.getToken();
|
|
113
|
+
const defaultHeaders = {
|
|
114
|
+
'ngrok-skip-browser-warning': 'true'
|
|
115
|
+
};
|
|
116
|
+
if (this.accessToken) {
|
|
117
|
+
defaultHeaders['Authorization'] = `Bearer ${this.accessToken}`;
|
|
118
|
+
}
|
|
119
|
+
const response = yield fetch(url, {
|
|
120
|
+
method: 'GET',
|
|
121
|
+
headers: defaultHeaders,
|
|
122
|
+
});
|
|
123
|
+
if (!response.ok) {
|
|
124
|
+
const errorData = yield response.json().catch(() => ({}));
|
|
125
|
+
throw new Error(errorData.message || `Download failed with status ${response.status}`);
|
|
126
|
+
}
|
|
127
|
+
return response.blob();
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
clearAuth() {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
this.accessToken = null;
|
|
133
|
+
this.refreshToken = null;
|
|
134
|
+
this.user = null;
|
|
135
|
+
yield this.storage.removeItem('access_token');
|
|
136
|
+
yield this.storage.removeItem('refresh_token');
|
|
137
|
+
yield this.storage.removeItem('user');
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
isTokenExpired(token, bufferMinutes = 5) {
|
|
141
|
+
try {
|
|
142
|
+
const decoded = jwtDecode(token);
|
|
143
|
+
const currentTime = Date.now() / 1000;
|
|
144
|
+
const bufferTime = bufferMinutes * 60;
|
|
145
|
+
return decoded.exp <= (currentTime + bufferTime);
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
refreshAccessToken() {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
if (!this.refreshToken) {
|
|
154
|
+
throw new Error('No refresh token available');
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
const response = yield this.request('/auth/refresh', 'POST', { refresh_token: this.refreshToken }, {}, true);
|
|
158
|
+
this.accessToken = response.access_token;
|
|
159
|
+
this.refreshToken = response.refresh_token;
|
|
160
|
+
this.user = response.user;
|
|
161
|
+
yield this.storage.setItem('access_token', JSON.stringify(response.access_token));
|
|
162
|
+
yield this.storage.setItem('refresh_token', JSON.stringify(response.refresh_token));
|
|
163
|
+
yield this.storage.setItem('user', JSON.stringify(response.user));
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
yield this.clearAuth();
|
|
167
|
+
throw new Error('Failed to refresh access token');
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
isAuthenticated() {
|
|
172
|
+
return !!this.accessToken;
|
|
173
|
+
}
|
|
174
|
+
getCurrentUser() {
|
|
175
|
+
return this.user;
|
|
176
|
+
}
|
|
177
|
+
getAccessToken() {
|
|
178
|
+
return this.accessToken;
|
|
179
|
+
}
|
|
180
|
+
getRefreshToken() {
|
|
181
|
+
return this.refreshToken;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseClient } from './base-client';
|
|
2
|
+
import { DebugSessionSummary } from '../types';
|
|
3
|
+
export declare class DebugModule extends BaseClient {
|
|
4
|
+
/**
|
|
5
|
+
* Get sessions that do not have medical transcriptions and primary transcription summaries
|
|
6
|
+
*/
|
|
7
|
+
getSessionsWithoutMedicalTranscriptions(): Promise<DebugSessionSummary[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Download a session as a ZIP file containing all related data (decrypted)
|
|
10
|
+
*/
|
|
11
|
+
downloadSessionAsZip(sessionId: string): Promise<Blob>;
|
|
12
|
+
/**
|
|
13
|
+
* Download a session as a ZIP file and create a download URL
|
|
14
|
+
*/
|
|
15
|
+
downloadSessionAsZipUrl(sessionId: string): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Download a session as a ZIP file and trigger browser download
|
|
18
|
+
*/
|
|
19
|
+
downloadSessionAndTriggerDownload(sessionId: string, filename?: string): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { BaseClient } from './base-client';
|
|
11
|
+
import urls from '../urls';
|
|
12
|
+
export class DebugModule extends BaseClient {
|
|
13
|
+
/**
|
|
14
|
+
* Get sessions that do not have medical transcriptions and primary transcription summaries
|
|
15
|
+
*/
|
|
16
|
+
getSessionsWithoutMedicalTranscriptions() {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
return this.request(`${urls.debug}/sessions/missing-medical-transcriptions`, 'GET');
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Download a session as a ZIP file containing all related data (decrypted)
|
|
23
|
+
*/
|
|
24
|
+
downloadSessionAsZip(sessionId) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return this.downloadRequest(`${urls.debug}/sessions/${sessionId}/download`);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Download a session as a ZIP file and create a download URL
|
|
31
|
+
*/
|
|
32
|
+
downloadSessionAsZipUrl(sessionId) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const blob = yield this.downloadSessionAsZip(sessionId);
|
|
35
|
+
return URL.createObjectURL(blob);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Download a session as a ZIP file and trigger browser download
|
|
40
|
+
*/
|
|
41
|
+
downloadSessionAndTriggerDownload(sessionId, filename) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const blob = yield this.downloadSessionAsZip(sessionId);
|
|
44
|
+
const url = URL.createObjectURL(blob);
|
|
45
|
+
const link = document.createElement('a');
|
|
46
|
+
link.href = url;
|
|
47
|
+
link.download = filename || `session_${sessionId}_${new Date().toISOString().split('T')[0]}.zip`;
|
|
48
|
+
document.body.appendChild(link);
|
|
49
|
+
link.click();
|
|
50
|
+
document.body.removeChild(link);
|
|
51
|
+
URL.revokeObjectURL(url);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseClient } from './base-client';
|
|
2
|
+
import { ExternalIntegration, CreateExternalIntegrationDto, UpdateExternalIntegrationDto } from '../types';
|
|
3
|
+
export declare class ExternalIntegrationModule extends BaseClient {
|
|
4
|
+
createExternalIntegration(data: CreateExternalIntegrationDto): Promise<ExternalIntegration>;
|
|
5
|
+
getExternalIntegrations(): Promise<ExternalIntegration[]>;
|
|
6
|
+
getExternalIntegration(id: string): Promise<ExternalIntegration>;
|
|
7
|
+
updateExternalIntegration(id: string, data: UpdateExternalIntegrationDto): Promise<ExternalIntegration>;
|
|
8
|
+
deleteExternalIntegration(id: string): Promise<void>;
|
|
9
|
+
}
|