whio-api-sdk 1.1.28 → 1.1.29
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 +90 -5
- package/dist/src/sdk/modules/agent.module.js +87 -2
- package/dist/src/sdk/modules/audio.module.d.ts +143 -2
- package/dist/src/sdk/modules/audio.module.js +144 -5
- package/dist/src/sdk/modules/auth.module.d.ts +43 -0
- package/dist/src/sdk/modules/auth.module.js +43 -0
- package/dist/src/sdk/modules/data-strategy.module.d.ts +45 -7
- package/dist/src/sdk/modules/data-strategy.module.js +39 -1
- package/dist/src/sdk/modules/external-integration.module.d.ts +30 -0
- package/dist/src/sdk/modules/external-integration.module.js +30 -0
- package/dist/src/sdk/modules/integration-action.module.d.ts +39 -0
- package/dist/src/sdk/modules/integration-action.module.js +39 -0
- package/dist/src/sdk/modules/log.module.d.ts +4 -4
- package/dist/src/sdk/modules/organization.module.d.ts +62 -3
- package/dist/src/sdk/modules/organization.module.js +61 -2
- package/dist/src/sdk/modules/patient.module.d.ts +5 -2
- package/dist/src/sdk/modules/patient.module.js +5 -2
- package/dist/src/sdk/modules/reports.module.d.ts +4 -4
- package/dist/src/sdk/modules/reports.module.js +6 -6
- package/dist/src/sdk/modules/session/orgadmin-session.module.d.ts +46 -1
- package/dist/src/sdk/modules/session/orgadmin-session.module.js +53 -6
- package/dist/src/sdk/modules/session/session.module.d.ts +62 -1
- package/dist/src/sdk/modules/session/session.module.js +64 -1
- package/dist/src/sdk/modules/session/superuser-session.module.d.ts +46 -1
- package/dist/src/sdk/modules/session/superuser-session.module.js +52 -5
- package/dist/src/sdk/modules/session.module.d.ts +142 -3
- package/dist/src/sdk/modules/session.module.js +153 -12
- package/dist/src/sdk/modules/team.module.d.ts +56 -4
- package/dist/src/sdk/modules/team.module.js +54 -6
- package/dist/src/sdk/modules/template.module.d.ts +96 -4
- package/dist/src/sdk/modules/template.module.js +95 -24
- package/dist/src/sdk/modules/transcription-summary.module.d.ts +60 -3
- package/dist/src/sdk/modules/transcription-summary.module.js +60 -7
- package/dist/src/sdk/modules/user.module.d.ts +106 -0
- package/dist/src/sdk/modules/user.module.js +107 -1
- package/dist/src/sdk/modules/websocket.module.d.ts +25 -8
- package/dist/src/sdk/modules/websocket.module.js +23 -6
- package/dist/src/sdk/modules/workflow.module.d.ts +39 -0
- package/dist/src/sdk/modules/workflow.module.js +39 -0
- package/dist/src/sdk/sdk.d.ts +19 -29
- package/dist/src/sdk/sdk.js +1 -44
- package/dist/src/sdk/types/agent.types.d.ts +3 -0
- package/dist/src/sdk/types/audio.types.d.ts +8 -9
- package/dist/src/sdk/types/data-strategy.types.d.ts +3 -0
- package/dist/src/sdk/types/external-integration.types.d.ts +6 -0
- package/dist/src/sdk/types/log.types.d.ts +2 -21
- package/dist/src/sdk/types/patient.types.d.ts +2 -3
- package/dist/src/sdk/types/reports.types.d.ts +1 -1
- package/dist/src/sdk/types/session.types.d.ts +8 -8
- package/dist/src/sdk/types/team.types.d.ts +4 -3
- package/dist/src/sdk/types/template.types.d.ts +15 -7
- package/dist/src/sdk/types/user.types.d.ts +6 -0
- package/dist/src/sdk/types/websocket.types.d.ts +4 -10
- package/dist/src/sdk/urls.d.ts +0 -4
- package/dist/src/sdk/urls.js +0 -5
- package/dist/src/sdk/whio-orgadmin-sdk.d.ts +7 -7
- package/dist/src/sdk/whio-sdk.d.ts +11 -8
- package/dist/src/sdk/whio-sdk.js +34 -18
- package/dist/src/sdk/whio-superuser-sdk.d.ts +12 -16
- package/dist/src/sdk/whio-superuser-sdk.js +1 -16
- package/dist/src/sdk/whio-teamadmin-sdk.d.ts +4 -8
- package/dist/src/sdk/whio-teamadmin-sdk.js +1 -18
- package/package.json +1 -1
- package/src/sdk/modules/agent.module.ts +94 -9
- package/src/sdk/modules/audio.module.ts +146 -8
- package/src/sdk/modules/auth.module.ts +43 -0
- package/src/sdk/modules/data-strategy.module.ts +51 -13
- package/src/sdk/modules/external-integration.module.ts +30 -0
- package/src/sdk/modules/integration-action.module.ts +39 -0
- package/src/sdk/modules/log.module.ts +4 -4
- package/src/sdk/modules/organization.module.ts +64 -5
- package/src/sdk/modules/patient.module.ts +5 -2
- package/src/sdk/modules/reports.module.ts +6 -6
- package/src/sdk/modules/session/orgadmin-session.module.ts +53 -7
- package/src/sdk/modules/session/session.module.ts +64 -2
- package/src/sdk/modules/session/superuser-session.module.ts +52 -6
- package/src/sdk/modules/session.module.ts +155 -15
- package/src/sdk/modules/team.module.ts +58 -9
- package/src/sdk/modules/template.module.ts +95 -32
- package/src/sdk/modules/transcription-summary.module.ts +62 -8
- package/src/sdk/modules/user.module.ts +108 -2
- package/src/sdk/modules/websocket.module.ts +26 -8
- package/src/sdk/modules/workflow.module.ts +39 -0
- package/src/sdk/sdk.ts +1 -37
- package/src/sdk/types/agent.types.ts +5 -0
- package/src/sdk/types/audio.types.ts +8 -10
- package/src/sdk/types/data-strategy.types.ts +3 -0
- package/src/sdk/types/external-integration.types.ts +6 -0
- package/src/sdk/types/log.types.ts +4 -23
- package/src/sdk/types/patient.types.ts +2 -3
- package/src/sdk/types/reports.types.ts +1 -1
- package/src/sdk/types/session.types.ts +8 -8
- package/src/sdk/types/team.types.ts +5 -3
- package/src/sdk/types/template.types.ts +18 -7
- package/src/sdk/types/user.types.ts +6 -0
- package/src/sdk/types/websocket.types.ts +8 -7
- package/src/sdk/urls.ts +0 -7
- package/src/sdk/whio-sdk.ts +29 -16
- package/src/sdk/whio-superuser-sdk.ts +1 -16
- package/src/sdk/whio-teamadmin-sdk.ts +1 -16
- package/tsconfig.json +1 -1
- package/src/sdk/modules/debug.module.ts +0 -44
|
@@ -14,6 +14,15 @@ export class AudioModule extends BaseClient {
|
|
|
14
14
|
// ======================
|
|
15
15
|
// AUDIO FILE METHODS
|
|
16
16
|
// ======================
|
|
17
|
+
/**
|
|
18
|
+
* Upload an audio file to a session via multipart form data.
|
|
19
|
+
*
|
|
20
|
+
* @param sessionId - UUID of the session to attach the audio file to.
|
|
21
|
+
* @param file - The audio file or blob to upload.
|
|
22
|
+
* @param fileName - Optional file name to send with the upload.
|
|
23
|
+
* @param onProgress - Optional callback invoked with the upload percentage (0-100).
|
|
24
|
+
* @returns The created audio file record.
|
|
25
|
+
*/
|
|
17
26
|
uploadAudioFileToSession(sessionId, file, fileName, onProgress) {
|
|
18
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
28
|
const formData = new FormData();
|
|
@@ -21,56 +30,113 @@ export class AudioModule extends BaseClient {
|
|
|
21
30
|
return this.fileUploadRequest(`${urls.audioFiles}/upload/${sessionId}`, formData, {}, onProgress);
|
|
22
31
|
});
|
|
23
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Upload an audio file to a session and queue it for transcription.
|
|
35
|
+
*
|
|
36
|
+
* @param sessionId - UUID of the session to attach the audio file to.
|
|
37
|
+
* @param file - The audio file or blob to upload.
|
|
38
|
+
* @param options - Optional settings: `fileName` and an `onProgress` callback (0-100).
|
|
39
|
+
* @returns The created audio file record.
|
|
40
|
+
*/
|
|
24
41
|
uploadAudioFileWithTranscriptionQueue(sessionId, file, options) {
|
|
25
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
43
|
const formData = new FormData();
|
|
27
44
|
formData.append('file', file, options === null || options === void 0 ? void 0 : options.fileName);
|
|
28
|
-
if (options === null || options === void 0 ? void 0 : options.culturalTranscription) {
|
|
29
|
-
formData.append('cultural_transcription', options.culturalTranscription);
|
|
30
|
-
}
|
|
31
45
|
return this.fileUploadRequest(`${urls.audioFiles}/upload/${sessionId}`, formData, {}, options === null || options === void 0 ? void 0 : options.onProgress);
|
|
32
46
|
});
|
|
33
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Retrieve the current user's audio files.
|
|
50
|
+
*
|
|
51
|
+
* @returns An array of audio files belonging to the current user.
|
|
52
|
+
*/
|
|
34
53
|
getMyAudioFiles() {
|
|
35
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
55
|
return this.request(`${urls.audioFiles}/my-files`, 'GET');
|
|
37
56
|
});
|
|
38
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Retrieve all audio files accessible to the current user.
|
|
60
|
+
*
|
|
61
|
+
* @returns An array of audio files.
|
|
62
|
+
*/
|
|
39
63
|
getAllAudioFiles() {
|
|
40
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
65
|
return this.request(`${urls.audioFiles}/all`, 'GET');
|
|
42
66
|
});
|
|
43
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Retrieve all audio files belonging to the current user's organization.
|
|
70
|
+
*
|
|
71
|
+
* @returns An array of audio files.
|
|
72
|
+
*/
|
|
44
73
|
getOrganizationAudioFiles() {
|
|
45
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
75
|
return this.request(`${urls.audioFiles}/organization`, 'GET');
|
|
47
76
|
});
|
|
48
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Retrieve all audio files for a given session.
|
|
80
|
+
*
|
|
81
|
+
* @param sessionId - UUID of the session.
|
|
82
|
+
* @returns An array of audio files for the session.
|
|
83
|
+
*/
|
|
49
84
|
getAudioFilesBySession(sessionId) {
|
|
50
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
86
|
return this.request(`${urls.audioFiles}/session/${sessionId}`, 'GET');
|
|
52
87
|
});
|
|
53
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Retrieve a single audio file by id.
|
|
91
|
+
*
|
|
92
|
+
* @param id - UUID of the audio file.
|
|
93
|
+
* @returns The requested audio file.
|
|
94
|
+
*/
|
|
54
95
|
getAudioFile(id) {
|
|
55
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
97
|
return this.request(`${urls.audioFiles}/${id}`, 'GET');
|
|
57
98
|
});
|
|
58
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Update an audio file's metadata.
|
|
102
|
+
*
|
|
103
|
+
* @param id - UUID of the audio file to update.
|
|
104
|
+
* @param updates - Fields to update (transcription URL and/or status).
|
|
105
|
+
* @returns The updated audio file.
|
|
106
|
+
*/
|
|
59
107
|
updateAudioFile(id, updates) {
|
|
60
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
109
|
return this.request(`${urls.audioFiles}/${id}`, 'PATCH', updates);
|
|
62
110
|
});
|
|
63
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Delete an audio file by id.
|
|
114
|
+
*
|
|
115
|
+
* @param id - UUID of the audio file to delete.
|
|
116
|
+
* @returns The deleted audio file record.
|
|
117
|
+
*/
|
|
64
118
|
deleteAudioFile(id) {
|
|
65
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
|
|
120
|
+
return this.request(`${urls.audioFiles}/${id}`, 'DELETE');
|
|
67
121
|
});
|
|
68
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Download an audio file as a blob.
|
|
125
|
+
*
|
|
126
|
+
* @param id - UUID of the audio file to download.
|
|
127
|
+
* @returns The audio file contents as a Blob.
|
|
128
|
+
*/
|
|
69
129
|
downloadAudioFile(id) {
|
|
70
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
131
|
return this.downloadRequest(`${urls.audioFiles}/${id}/download`);
|
|
72
132
|
});
|
|
73
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Download an audio file and return an object URL pointing to it.
|
|
136
|
+
*
|
|
137
|
+
* @param id - UUID of the audio file to download.
|
|
138
|
+
* @returns An object URL referencing the downloaded blob.
|
|
139
|
+
*/
|
|
74
140
|
downloadAudioFileAsUrl(id) {
|
|
75
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
142
|
const blob = yield this.downloadAudioFile(id);
|
|
@@ -80,18 +146,33 @@ export class AudioModule extends BaseClient {
|
|
|
80
146
|
// ======================
|
|
81
147
|
// TRANSCRIPTION QUEUE HELPER METHODS
|
|
82
148
|
// ======================
|
|
149
|
+
/**
|
|
150
|
+
* Retrieve the current user's audio files that have finished transcription.
|
|
151
|
+
*
|
|
152
|
+
* @returns An array of transcribed audio files.
|
|
153
|
+
*/
|
|
83
154
|
getTranscribedAudioFiles() {
|
|
84
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
156
|
const audioFiles = yield this.getMyAudioFiles();
|
|
86
|
-
return audioFiles.filter(file => file.status === AudioFileStatus.TRANSCRIBED
|
|
157
|
+
return audioFiles.filter(file => file.status === AudioFileStatus.TRANSCRIBED);
|
|
87
158
|
});
|
|
88
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Retrieve the current user's audio files that are currently processing.
|
|
162
|
+
*
|
|
163
|
+
* @returns An array of processing audio files.
|
|
164
|
+
*/
|
|
89
165
|
getProcessingAudioFiles() {
|
|
90
166
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
167
|
const audioFiles = yield this.getMyAudioFiles();
|
|
92
168
|
return audioFiles.filter(file => file.status === AudioFileStatus.PROCESSING);
|
|
93
169
|
});
|
|
94
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Retrieve the current user's audio files that failed processing.
|
|
173
|
+
*
|
|
174
|
+
* @returns An array of failed audio files.
|
|
175
|
+
*/
|
|
95
176
|
getFailedAudioFiles() {
|
|
96
177
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
178
|
const audioFiles = yield this.getMyAudioFiles();
|
|
@@ -101,41 +182,90 @@ export class AudioModule extends BaseClient {
|
|
|
101
182
|
// ======================
|
|
102
183
|
// BASE64 AUDIO FILE METHODS
|
|
103
184
|
// ======================
|
|
185
|
+
/**
|
|
186
|
+
* Create a base64 audio file record.
|
|
187
|
+
*
|
|
188
|
+
* @param dto - The session id and initial base64 audio chunks.
|
|
189
|
+
* @returns The created base64 audio file.
|
|
190
|
+
*/
|
|
104
191
|
createBase64AudioFile(dto) {
|
|
105
192
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
193
|
return this.request(`${urls.audioFiles}/base64`, 'POST', dto);
|
|
107
194
|
});
|
|
108
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Retrieve all base64 audio files accessible to the current user.
|
|
198
|
+
*
|
|
199
|
+
* @returns An array of base64 audio files.
|
|
200
|
+
*/
|
|
109
201
|
getAllBase64AudioFiles() {
|
|
110
202
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
203
|
return this.request(`${urls.audioFiles}/base64/all`, 'GET');
|
|
112
204
|
});
|
|
113
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Retrieve base64 audio files for a given session.
|
|
208
|
+
*
|
|
209
|
+
* @param sessionId - UUID of the session.
|
|
210
|
+
* @returns An array of base64 audio files for the session.
|
|
211
|
+
*/
|
|
114
212
|
getBase64AudioFilesBySession(sessionId) {
|
|
115
213
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
214
|
return this.request(`${urls.audioFiles}/base64/session/${sessionId}`, 'GET');
|
|
117
215
|
});
|
|
118
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Retrieve a single base64 audio file by id.
|
|
219
|
+
*
|
|
220
|
+
* @param id - UUID of the base64 audio file.
|
|
221
|
+
* @returns The requested base64 audio file.
|
|
222
|
+
*/
|
|
119
223
|
getBase64AudioFile(id) {
|
|
120
224
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
225
|
return this.request(`${urls.audioFiles}/base64/${id}`, 'GET');
|
|
122
226
|
});
|
|
123
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Update a base64 audio file record.
|
|
230
|
+
*
|
|
231
|
+
* @param id - UUID of the base64 audio file to update.
|
|
232
|
+
* @param updates - Fields to update (session id and/or audio chunks).
|
|
233
|
+
* @returns The updated base64 audio file.
|
|
234
|
+
*/
|
|
124
235
|
updateBase64AudioFile(id, updates) {
|
|
125
236
|
return __awaiter(this, void 0, void 0, function* () {
|
|
126
237
|
return this.request(`${urls.audioFiles}/base64/${id}`, 'PATCH', updates);
|
|
127
238
|
});
|
|
128
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Delete a base64 audio file by id.
|
|
242
|
+
*
|
|
243
|
+
* @param id - UUID of the base64 audio file to delete.
|
|
244
|
+
* @returns A promise that resolves once the record is deleted.
|
|
245
|
+
*/
|
|
129
246
|
deleteBase64AudioFile(id) {
|
|
130
247
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
248
|
yield this.request(`${urls.audioFiles}/base64/${id}`, 'DELETE');
|
|
132
249
|
});
|
|
133
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Append base64 audio chunks to a session's base64 audio file.
|
|
253
|
+
*
|
|
254
|
+
* @param sessionId - UUID of the session.
|
|
255
|
+
* @param base64Chunks - The base64-encoded audio chunks to append.
|
|
256
|
+
* @returns The count of chunks now stored.
|
|
257
|
+
*/
|
|
134
258
|
addBase64Chunk(sessionId, base64Chunks) {
|
|
135
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
260
|
return this.request(`${urls.audioFiles}/base64/add-chunk/${sessionId}`, 'POST', { base64Chunks });
|
|
137
261
|
});
|
|
138
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Queue a session's accumulated base64 audio for transcription.
|
|
265
|
+
*
|
|
266
|
+
* @param sessionId - UUID of the session to transcribe.
|
|
267
|
+
* @returns An object indicating whether queuing succeeded.
|
|
268
|
+
*/
|
|
139
269
|
queueSessionBase64AudioForTranscription(sessionId) {
|
|
140
270
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
271
|
return this.request(`${urls.audioFiles}/session/${sessionId}/transcribe`, 'POST');
|
|
@@ -144,6 +274,15 @@ export class AudioModule extends BaseClient {
|
|
|
144
274
|
// ======================
|
|
145
275
|
// DIRECT TRANSCRIPTION METHODS
|
|
146
276
|
// ======================
|
|
277
|
+
/**
|
|
278
|
+
* Transcribe an audio file directly without persisting it to a session.
|
|
279
|
+
*
|
|
280
|
+
* @param file - The audio file or blob to transcribe.
|
|
281
|
+
* @param fileName - Optional file name to send with the upload.
|
|
282
|
+
* @param useFineTuned - Optional flag to use the fine-tuned transcription model.
|
|
283
|
+
* @param onProgress - Optional callback invoked with the upload percentage (0-100).
|
|
284
|
+
* @returns An object containing the resulting transcription text.
|
|
285
|
+
*/
|
|
147
286
|
transcribeAudioFileDirect(file, fileName, useFineTuned, onProgress) {
|
|
148
287
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
288
|
const formData = new FormData();
|
|
@@ -1,14 +1,57 @@
|
|
|
1
1
|
import { BaseClient } from './base-client';
|
|
2
2
|
import { LoginCredentials, LoginResponse, PasswordChangeResponse, User } from '../types';
|
|
3
3
|
export declare class AuthModule extends BaseClient {
|
|
4
|
+
/**
|
|
5
|
+
* Authenticate with email and password and persist the resulting session.
|
|
6
|
+
*
|
|
7
|
+
* @param credentials - The login credentials (email and password).
|
|
8
|
+
* @returns The login response including access/refresh tokens and the user.
|
|
9
|
+
*/
|
|
4
10
|
login(credentials: LoginCredentials): Promise<LoginResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* Request a one-time login code be sent to the given email address.
|
|
13
|
+
*
|
|
14
|
+
* @param email - The email address to send the login code to.
|
|
15
|
+
* @returns A confirmation message.
|
|
16
|
+
*/
|
|
5
17
|
requestLoginCode(email: string): Promise<{
|
|
6
18
|
message: string;
|
|
7
19
|
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Authenticate with an email and one-time login code and persist the session.
|
|
22
|
+
*
|
|
23
|
+
* @param email - The email address the code was sent to.
|
|
24
|
+
* @param code - The one-time login code.
|
|
25
|
+
* @returns The login response including access/refresh tokens and the user.
|
|
26
|
+
*/
|
|
8
27
|
loginWithCode(email: string, code: string): Promise<LoginResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Clear the current session and any persisted authentication state.
|
|
30
|
+
*
|
|
31
|
+
* @returns A promise that resolves when the session is cleared.
|
|
32
|
+
*/
|
|
9
33
|
logout(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Fetch the authenticated user's profile.
|
|
36
|
+
*
|
|
37
|
+
* @returns The current user.
|
|
38
|
+
*/
|
|
10
39
|
getProfile(): Promise<User>;
|
|
40
|
+
/**
|
|
41
|
+
* Change the authenticated user's password.
|
|
42
|
+
*
|
|
43
|
+
* @param currentPassword - The user's current password.
|
|
44
|
+
* @param newPassword - The new password to set.
|
|
45
|
+
* @returns The password change response.
|
|
46
|
+
*/
|
|
11
47
|
changePassword(currentPassword: string, newPassword: string): Promise<PasswordChangeResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* Change another user's password as an administrator.
|
|
50
|
+
*
|
|
51
|
+
* @param userId - UUID of the user whose password is being changed.
|
|
52
|
+
* @param newPassword - The new password to set.
|
|
53
|
+
* @returns The password change response.
|
|
54
|
+
*/
|
|
12
55
|
adminChangePassword(userId: string, newPassword: string): Promise<PasswordChangeResponse>;
|
|
13
56
|
private updateAuthState;
|
|
14
57
|
}
|
|
@@ -10,6 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { BaseClient } from './base-client';
|
|
11
11
|
import urls from '../urls';
|
|
12
12
|
export class AuthModule extends BaseClient {
|
|
13
|
+
/**
|
|
14
|
+
* Authenticate with email and password and persist the resulting session.
|
|
15
|
+
*
|
|
16
|
+
* @param credentials - The login credentials (email and password).
|
|
17
|
+
* @returns The login response including access/refresh tokens and the user.
|
|
18
|
+
*/
|
|
13
19
|
login(credentials) {
|
|
14
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
21
|
try {
|
|
@@ -23,11 +29,24 @@ export class AuthModule extends BaseClient {
|
|
|
23
29
|
}
|
|
24
30
|
});
|
|
25
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Request a one-time login code be sent to the given email address.
|
|
34
|
+
*
|
|
35
|
+
* @param email - The email address to send the login code to.
|
|
36
|
+
* @returns A confirmation message.
|
|
37
|
+
*/
|
|
26
38
|
requestLoginCode(email) {
|
|
27
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
40
|
return this.request('/auth/request-login-code', 'POST', { email }, {}, true);
|
|
29
41
|
});
|
|
30
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Authenticate with an email and one-time login code and persist the session.
|
|
45
|
+
*
|
|
46
|
+
* @param email - The email address the code was sent to.
|
|
47
|
+
* @param code - The one-time login code.
|
|
48
|
+
* @returns The login response including access/refresh tokens and the user.
|
|
49
|
+
*/
|
|
31
50
|
loginWithCode(email, code) {
|
|
32
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
52
|
try {
|
|
@@ -41,16 +60,33 @@ export class AuthModule extends BaseClient {
|
|
|
41
60
|
}
|
|
42
61
|
});
|
|
43
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Clear the current session and any persisted authentication state.
|
|
65
|
+
*
|
|
66
|
+
* @returns A promise that resolves when the session is cleared.
|
|
67
|
+
*/
|
|
44
68
|
logout() {
|
|
45
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
70
|
yield this.clearAuth();
|
|
47
71
|
});
|
|
48
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Fetch the authenticated user's profile.
|
|
75
|
+
*
|
|
76
|
+
* @returns The current user.
|
|
77
|
+
*/
|
|
49
78
|
getProfile() {
|
|
50
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
80
|
return this.request(urls.profile, 'GET');
|
|
52
81
|
});
|
|
53
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Change the authenticated user's password.
|
|
85
|
+
*
|
|
86
|
+
* @param currentPassword - The user's current password.
|
|
87
|
+
* @param newPassword - The new password to set.
|
|
88
|
+
* @returns The password change response.
|
|
89
|
+
*/
|
|
54
90
|
changePassword(currentPassword, newPassword) {
|
|
55
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
92
|
const dto = {
|
|
@@ -60,6 +96,13 @@ export class AuthModule extends BaseClient {
|
|
|
60
96
|
return this.request(urls.changePassword, 'PATCH', dto);
|
|
61
97
|
});
|
|
62
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Change another user's password as an administrator.
|
|
101
|
+
*
|
|
102
|
+
* @param userId - UUID of the user whose password is being changed.
|
|
103
|
+
* @param newPassword - The new password to set.
|
|
104
|
+
* @returns The password change response.
|
|
105
|
+
*/
|
|
63
106
|
adminChangePassword(userId, newPassword) {
|
|
64
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
108
|
const dto = {
|
|
@@ -1,10 +1,48 @@
|
|
|
1
1
|
import { BaseClient } from './base-client';
|
|
2
|
-
import { DataStrategy, CreateDataStrategyDto, UpdateDataStrategyDto } from '../types';
|
|
2
|
+
import { DataStrategy, DataStrategyWithOrganization, CreateDataStrategyDto, UpdateDataStrategyDto } from '../types';
|
|
3
3
|
export declare class DataStrategyModule extends BaseClient {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Create a data strategy for an organization.
|
|
6
|
+
*
|
|
7
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
8
|
+
* @param options - Optional retention settings for the data strategy.
|
|
9
|
+
* @returns The created data strategy with its organization populated.
|
|
10
|
+
*/
|
|
11
|
+
createDataStrategy(organizationId?: string, options?: Omit<CreateDataStrategyDto, 'organizationId'>): Promise<DataStrategyWithOrganization>;
|
|
12
|
+
/**
|
|
13
|
+
* List data strategies, optionally filtered by organization.
|
|
14
|
+
*
|
|
15
|
+
* @param organizationId - Optional organization UUID to filter by.
|
|
16
|
+
* @returns An array of data strategies, each with its organization populated.
|
|
17
|
+
*/
|
|
18
|
+
getDataStrategies(organizationId?: string): Promise<DataStrategyWithOrganization[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Get a single data strategy by id.
|
|
21
|
+
*
|
|
22
|
+
* @param id - UUID of the data strategy.
|
|
23
|
+
* @returns The data strategy with its organization populated.
|
|
24
|
+
*/
|
|
25
|
+
getDataStrategy(id: string): Promise<DataStrategyWithOrganization>;
|
|
26
|
+
/**
|
|
27
|
+
* Get the data strategy for a specific organization.
|
|
28
|
+
*
|
|
29
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
30
|
+
* @returns The data strategy with its organization populated.
|
|
31
|
+
*/
|
|
32
|
+
getDataStrategyByOrganization(organizationId?: string): Promise<DataStrategyWithOrganization>;
|
|
33
|
+
/**
|
|
34
|
+
* Update a data strategy.
|
|
35
|
+
*
|
|
36
|
+
* @param id - UUID of the data strategy to update.
|
|
37
|
+
* @param data - The retention settings to update.
|
|
38
|
+
* @returns The updated data strategy with its organization populated.
|
|
39
|
+
*/
|
|
40
|
+
updateDataStrategy(id: string, data: UpdateDataStrategyDto): Promise<DataStrategyWithOrganization>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete a data strategy.
|
|
43
|
+
*
|
|
44
|
+
* @param id - UUID of the data strategy to delete.
|
|
45
|
+
* @returns The deleted data strategy entity.
|
|
46
|
+
*/
|
|
47
|
+
deleteDataStrategy(id: string): Promise<DataStrategy>;
|
|
10
48
|
}
|
|
@@ -10,37 +10,75 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { BaseClient } from './base-client';
|
|
11
11
|
import urls from '../urls';
|
|
12
12
|
export class DataStrategyModule extends BaseClient {
|
|
13
|
+
/**
|
|
14
|
+
* Create a data strategy for an organization.
|
|
15
|
+
*
|
|
16
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
17
|
+
* @param options - Optional retention settings for the data strategy.
|
|
18
|
+
* @returns The created data strategy with its organization populated.
|
|
19
|
+
*/
|
|
13
20
|
createDataStrategy(organizationId, options) {
|
|
14
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
22
|
const dto = Object.assign({ organizationId: organizationId || this.user.organizationId }, options);
|
|
16
23
|
return this.request(urls.dataStrategies, 'POST', dto);
|
|
17
24
|
});
|
|
18
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* List data strategies, optionally filtered by organization.
|
|
28
|
+
*
|
|
29
|
+
* @param organizationId - Optional organization UUID to filter by.
|
|
30
|
+
* @returns An array of data strategies, each with its organization populated.
|
|
31
|
+
*/
|
|
19
32
|
getDataStrategies(organizationId) {
|
|
20
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
34
|
const params = organizationId ? `?organizationId=${organizationId}` : '';
|
|
22
35
|
return this.request(`${urls.dataStrategies}${params}`, 'GET');
|
|
23
36
|
});
|
|
24
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Get a single data strategy by id.
|
|
40
|
+
*
|
|
41
|
+
* @param id - UUID of the data strategy.
|
|
42
|
+
* @returns The data strategy with its organization populated.
|
|
43
|
+
*/
|
|
25
44
|
getDataStrategy(id) {
|
|
26
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
46
|
return this.request(`${urls.dataStrategies}/${id}`, 'GET');
|
|
28
47
|
});
|
|
29
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Get the data strategy for a specific organization.
|
|
51
|
+
*
|
|
52
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
53
|
+
* @returns The data strategy with its organization populated.
|
|
54
|
+
*/
|
|
30
55
|
getDataStrategyByOrganization(organizationId) {
|
|
31
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
57
|
const orgId = organizationId || this.user.organizationId;
|
|
33
58
|
return this.request(`${urls.dataStrategies}?organizationId=${orgId}`, 'GET');
|
|
34
59
|
});
|
|
35
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Update a data strategy.
|
|
63
|
+
*
|
|
64
|
+
* @param id - UUID of the data strategy to update.
|
|
65
|
+
* @param data - The retention settings to update.
|
|
66
|
+
* @returns The updated data strategy with its organization populated.
|
|
67
|
+
*/
|
|
36
68
|
updateDataStrategy(id, data) {
|
|
37
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
70
|
return this.request(`${urls.dataStrategies}/${id}`, 'PATCH', data);
|
|
39
71
|
});
|
|
40
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Delete a data strategy.
|
|
75
|
+
*
|
|
76
|
+
* @param id - UUID of the data strategy to delete.
|
|
77
|
+
* @returns The deleted data strategy entity.
|
|
78
|
+
*/
|
|
41
79
|
deleteDataStrategy(id) {
|
|
42
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
|
|
81
|
+
return this.request(`${urls.dataStrategies}/${id}`, 'DELETE');
|
|
44
82
|
});
|
|
45
83
|
}
|
|
46
84
|
}
|
|
@@ -1,9 +1,39 @@
|
|
|
1
1
|
import { BaseClient } from './base-client';
|
|
2
2
|
import { ExternalIntegration, CreateExternalIntegrationDto, UpdateExternalIntegrationDto } from '../types';
|
|
3
3
|
export declare class ExternalIntegrationModule extends BaseClient {
|
|
4
|
+
/**
|
|
5
|
+
* Create an external integration. The `apiKey` is sent as plaintext and stored encrypted at rest.
|
|
6
|
+
*
|
|
7
|
+
* @param data - The external integration payload (endpoints, apiKey, headerName, etc.).
|
|
8
|
+
* @returns The created external integration (its `apiKey` is returned masked).
|
|
9
|
+
*/
|
|
4
10
|
createExternalIntegration(data: CreateExternalIntegrationDto): Promise<ExternalIntegration>;
|
|
11
|
+
/**
|
|
12
|
+
* List all external integrations.
|
|
13
|
+
*
|
|
14
|
+
* @returns An array of external integrations (each `apiKey` is returned masked).
|
|
15
|
+
*/
|
|
5
16
|
getExternalIntegrations(): Promise<ExternalIntegration[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Get a single external integration by id.
|
|
19
|
+
*
|
|
20
|
+
* @param id - UUID of the external integration.
|
|
21
|
+
* @returns The external integration (its `apiKey` is returned masked).
|
|
22
|
+
*/
|
|
6
23
|
getExternalIntegration(id: string): Promise<ExternalIntegration>;
|
|
24
|
+
/**
|
|
25
|
+
* Update an external integration. A supplied `apiKey` is sent as plaintext and stored encrypted at rest.
|
|
26
|
+
*
|
|
27
|
+
* @param id - UUID of the external integration to update.
|
|
28
|
+
* @param data - The fields to update.
|
|
29
|
+
* @returns The updated external integration (its `apiKey` is returned masked).
|
|
30
|
+
*/
|
|
7
31
|
updateExternalIntegration(id: string, data: UpdateExternalIntegrationDto): Promise<ExternalIntegration>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete an external integration.
|
|
34
|
+
*
|
|
35
|
+
* @param id - UUID of the external integration to delete.
|
|
36
|
+
* @returns A promise that resolves when the integration has been deleted.
|
|
37
|
+
*/
|
|
8
38
|
deleteExternalIntegration(id: string): Promise<void>;
|
|
9
39
|
}
|
|
@@ -10,26 +10,56 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { BaseClient } from './base-client';
|
|
11
11
|
import urls from '../urls';
|
|
12
12
|
export class ExternalIntegrationModule extends BaseClient {
|
|
13
|
+
/**
|
|
14
|
+
* Create an external integration. The `apiKey` is sent as plaintext and stored encrypted at rest.
|
|
15
|
+
*
|
|
16
|
+
* @param data - The external integration payload (endpoints, apiKey, headerName, etc.).
|
|
17
|
+
* @returns The created external integration (its `apiKey` is returned masked).
|
|
18
|
+
*/
|
|
13
19
|
createExternalIntegration(data) {
|
|
14
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
21
|
return this.request(urls.externalIntegrations, 'POST', data);
|
|
16
22
|
});
|
|
17
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* List all external integrations.
|
|
26
|
+
*
|
|
27
|
+
* @returns An array of external integrations (each `apiKey` is returned masked).
|
|
28
|
+
*/
|
|
18
29
|
getExternalIntegrations() {
|
|
19
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
31
|
return this.request(urls.externalIntegrations, 'GET');
|
|
21
32
|
});
|
|
22
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Get a single external integration by id.
|
|
36
|
+
*
|
|
37
|
+
* @param id - UUID of the external integration.
|
|
38
|
+
* @returns The external integration (its `apiKey` is returned masked).
|
|
39
|
+
*/
|
|
23
40
|
getExternalIntegration(id) {
|
|
24
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
42
|
return this.request(`${urls.externalIntegrations}/${id}`, 'GET');
|
|
26
43
|
});
|
|
27
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Update an external integration. A supplied `apiKey` is sent as plaintext and stored encrypted at rest.
|
|
47
|
+
*
|
|
48
|
+
* @param id - UUID of the external integration to update.
|
|
49
|
+
* @param data - The fields to update.
|
|
50
|
+
* @returns The updated external integration (its `apiKey` is returned masked).
|
|
51
|
+
*/
|
|
28
52
|
updateExternalIntegration(id, data) {
|
|
29
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
54
|
return this.request(`${urls.externalIntegrations}/${id}`, 'PATCH', data);
|
|
31
55
|
});
|
|
32
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Delete an external integration.
|
|
59
|
+
*
|
|
60
|
+
* @param id - UUID of the external integration to delete.
|
|
61
|
+
* @returns A promise that resolves when the integration has been deleted.
|
|
62
|
+
*/
|
|
33
63
|
deleteExternalIntegration(id) {
|
|
34
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
65
|
yield this.request(`${urls.externalIntegrations}/${id}`, 'DELETE');
|