@eka-care/ekascribe-ts-sdk 2.0.45 → 2.0.47
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 +145 -23
- package/dist/index.d.ts +4 -6
- package/dist/index.mjs +53 -68
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -141,7 +141,38 @@ const config = await ekascribe.getEkascribeConfig();
|
|
|
141
141
|
}
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
### 3.
|
|
144
|
+
### 3. Fetch user's favorite templates
|
|
145
|
+
|
|
146
|
+
Get the list of templates marked as favorites by the user (configured via `my_templates` in the config).
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
const myTemplates = await ekascribe.getConfigMyTemplates();
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
- #### Sample Response:
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
{
|
|
156
|
+
"data": {
|
|
157
|
+
"my_templates": [
|
|
158
|
+
{
|
|
159
|
+
"id": "template_123",
|
|
160
|
+
"name": "General Consultation"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"id": "template_456",
|
|
164
|
+
"name": "Cardiology Template"
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
"message": "Configuration fetched successfully",
|
|
169
|
+
"code": 200
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Note:** The `my_templates` field contains templates that were previously saved using the `updateConfig()` method (see Templates SDK Methods section).
|
|
174
|
+
|
|
175
|
+
### 4. Init transaction
|
|
145
176
|
|
|
146
177
|
Initialize a transaction before starting recording. This sets up the session with your configuration.
|
|
147
178
|
|
|
@@ -215,7 +246,7 @@ ekascribe.updateAuthTokens({ access_token: sdkConfig.access_token });
|
|
|
215
246
|
const response = await ekascribe.initTransaction({ ... });
|
|
216
247
|
```
|
|
217
248
|
|
|
218
|
-
###
|
|
249
|
+
### 5. Start recording
|
|
219
250
|
|
|
220
251
|
Start recording audio after initializing the transaction.
|
|
221
252
|
|
|
@@ -237,7 +268,7 @@ const response = await ekascribe.startRecording();
|
|
|
237
268
|
}
|
|
238
269
|
```
|
|
239
270
|
|
|
240
|
-
###
|
|
271
|
+
### 6. Pause recording
|
|
241
272
|
|
|
242
273
|
Pause the ongoing voice recording.
|
|
243
274
|
|
|
@@ -256,7 +287,7 @@ const response = await ekascribe.pauseRecording();
|
|
|
256
287
|
}
|
|
257
288
|
```
|
|
258
289
|
|
|
259
|
-
###
|
|
290
|
+
### 7. Resume recording
|
|
260
291
|
|
|
261
292
|
Resume a paused recording.
|
|
262
293
|
|
|
@@ -275,7 +306,7 @@ const response = await ekascribe.resumeRecording();
|
|
|
275
306
|
}
|
|
276
307
|
```
|
|
277
308
|
|
|
278
|
-
###
|
|
309
|
+
### 8. End recording
|
|
279
310
|
|
|
280
311
|
End the recording session. This method:
|
|
281
312
|
|
|
@@ -323,34 +354,31 @@ ekascribe.updateAuthTokens({ access_token: sdkConfig.access_token });
|
|
|
323
354
|
const response = await ekascribe.endRecording();
|
|
324
355
|
```
|
|
325
356
|
|
|
326
|
-
###
|
|
327
|
-
|
|
328
|
-
You can fetch output in two ways:
|
|
329
|
-
|
|
330
|
-
- `getTemplateOutput({ txn_id })`: polling is your responsibility; call repeatedly until processing finishes.
|
|
331
|
-
- `pollSessionOutput({ txn_id, max_polling_time })`: SDK polls for you and resolves when processing finishes (default max wait: 2 minutes; override via `max_polling_time`, pass time in milliseconds).
|
|
332
|
-
|
|
333
|
-
Example (manual polling):
|
|
334
|
-
|
|
335
|
-
```ts
|
|
336
|
-
const res = await ekascribe.getTemplateOutput({ txn_id: 'transaction-id' });
|
|
337
|
-
```
|
|
357
|
+
### 9. Get output recorded prescription
|
|
338
358
|
|
|
339
|
-
|
|
359
|
+
The SDK polls for you and resolves when processing finishes (default max wait: 2 minutes; override via `max_polling_time`, pass time in milliseconds).
|
|
340
360
|
|
|
341
361
|
```ts
|
|
342
362
|
// Waits up to 2 minutes by default; override as needed
|
|
343
363
|
const res = await ekascribe.pollSessionOutput({
|
|
344
364
|
txn_id: 'transaction-id',
|
|
345
365
|
max_polling_time: 2 * 60 * 1000, // optional
|
|
366
|
+
template_id: 'template-id', // optional
|
|
346
367
|
});
|
|
347
368
|
```
|
|
348
369
|
|
|
370
|
+
**Note:**
|
|
371
|
+
|
|
372
|
+
1. On passing `template_id` in request params, the function will return output only for that specific template ID. If `template_id` is not passed, it will return all template responses generated for that `txn_id`.
|
|
373
|
+
2. Use `onPartialResultCallback` (see Generic Callbacks section) before calling `pollSessionOutput` to receive real-time updates during polling, display partial transcription results, and improve user experience with processing progress indicators.
|
|
374
|
+
|
|
349
375
|
Status codes to handle:
|
|
350
376
|
|
|
351
377
|
- `200`: Success; all templates processed.
|
|
352
378
|
- `202`: Templates are still processing; poll again (or let `pollSessionOutput` continue).
|
|
353
379
|
- `206`: Partial success; some templates not processed fully.
|
|
380
|
+
- `401`: Authentication token expired. Update the token.
|
|
381
|
+
- `403`: Invalid Authentication token. Pass new token.
|
|
354
382
|
- `500`: All template processing failed, or internal server error; stop and surface error.
|
|
355
383
|
|
|
356
384
|
- #### Response type:
|
|
@@ -442,7 +470,7 @@ type TOutputSummary = {
|
|
|
442
470
|
}
|
|
443
471
|
```
|
|
444
472
|
|
|
445
|
-
###
|
|
473
|
+
### 10. Retry upload recording
|
|
446
474
|
|
|
447
475
|
Retry uploading failed audio files after `endRecording`.
|
|
448
476
|
|
|
@@ -482,7 +510,7 @@ ekascribe.updateAuthTokens({ access_token: sdkConfig.access_token });
|
|
|
482
510
|
const response = await ekascribe.retryUploadRecording({ force_commit: true });
|
|
483
511
|
```
|
|
484
512
|
|
|
485
|
-
###
|
|
513
|
+
### 11. Patch recording session status
|
|
486
514
|
|
|
487
515
|
Cancel or update the status of a recording session.
|
|
488
516
|
|
|
@@ -531,7 +559,7 @@ ekascribe.updateAuthTokens({ access_token: sdkConfig.access_token });
|
|
|
531
559
|
const response = await ekascribe.patchSessionStatus({ ... });
|
|
532
560
|
```
|
|
533
561
|
|
|
534
|
-
###
|
|
562
|
+
### 12. Commit transaction
|
|
535
563
|
|
|
536
564
|
Call this if `endRecording` returns `error_code: 'txn_commit_failed'` or the transaction is not yet committed.
|
|
537
565
|
|
|
@@ -564,7 +592,7 @@ ekascribe.updateAuthTokens({ access_token: sdkConfig.access_token });
|
|
|
564
592
|
const response = await ekascribe.commitTransactionCall();
|
|
565
593
|
```
|
|
566
594
|
|
|
567
|
-
###
|
|
595
|
+
### 13. Stop transaction
|
|
568
596
|
|
|
569
597
|
Use this method to stop a transaction that has not yet been stopped or returned a `txn_stop_failed` error in a previous step.
|
|
570
598
|
|
|
@@ -597,7 +625,7 @@ ekascribe.updateAuthTokens({ access_token: sdkConfig.access_token });
|
|
|
597
625
|
const response = await ekascribe.stopTransactionCall();
|
|
598
626
|
```
|
|
599
627
|
|
|
600
|
-
###
|
|
628
|
+
### 14. Get previous sessions
|
|
601
629
|
|
|
602
630
|
Fetch previous sessions. `txn_count` controls how many sessions the API returns.
|
|
603
631
|
|
|
@@ -635,6 +663,49 @@ const sessions = await ekascribe.getSessionHistory({ txn_count: 10 }); // txn_co
|
|
|
635
663
|
}
|
|
636
664
|
```
|
|
637
665
|
|
|
666
|
+
### 15. Convert response to other template post session
|
|
667
|
+
|
|
668
|
+
Use this method to convert an existing transcription from a completed transaction into a different template format. This is useful when you want to reformat existing transcription data without re-recording.
|
|
669
|
+
|
|
670
|
+
```ts
|
|
671
|
+
const response = await ekascribe.postTransactionConvertToTemplate({
|
|
672
|
+
txn_id: 'transaction-id-123',
|
|
673
|
+
template_id: 'new-template-id',
|
|
674
|
+
});
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
**Key Parameters:**
|
|
678
|
+
|
|
679
|
+
- `txn_id`: The transaction ID of the completed session you want to convert
|
|
680
|
+
- `template_id`: The ID of the template format you want to convert the transcription into
|
|
681
|
+
|
|
682
|
+
- #### Sample Response:
|
|
683
|
+
|
|
684
|
+
```ts
|
|
685
|
+
{
|
|
686
|
+
status: 'success' | 'failed';
|
|
687
|
+
message: string;
|
|
688
|
+
txn_id: string;
|
|
689
|
+
template_id: string;
|
|
690
|
+
b_id: string;
|
|
691
|
+
code: number;
|
|
692
|
+
msg: string;
|
|
693
|
+
error?: {
|
|
694
|
+
code: string;
|
|
695
|
+
message: string;
|
|
696
|
+
display_message: string;
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
**When to use:**
|
|
702
|
+
|
|
703
|
+
- When you need to apply a different template to an existing transcription
|
|
704
|
+
- To generate multiple template formats from the same recording session
|
|
705
|
+
- After completing a session, when you want to see the output in a different template structure
|
|
706
|
+
|
|
707
|
+
**Note:** After getting success response from this method, call `pollSessionOutput` (Point 9) to get the output for the new template_id.
|
|
708
|
+
|
|
638
709
|
## Templates SDK Methods
|
|
639
710
|
|
|
640
711
|
### 1. Get All Templates
|
|
@@ -1174,6 +1245,57 @@ ekascribe.onUserSpeechCallback((isSpeech) => {
|
|
|
1174
1245
|
});
|
|
1175
1246
|
```
|
|
1176
1247
|
|
|
1248
|
+
### 3. Partial result callback
|
|
1249
|
+
|
|
1250
|
+
This callback provides real-time partial results while polling for the final output. Use it to display intermediate transcription and template results to users before processing is complete.
|
|
1251
|
+
|
|
1252
|
+
```ts
|
|
1253
|
+
ekascribe.onPartialResultCallback((partialData) => {
|
|
1254
|
+
console.log('Partial result received:', partialData);
|
|
1255
|
+
|
|
1256
|
+
// Handle different poll statuses
|
|
1257
|
+
switch (partialData.poll_status) {
|
|
1258
|
+
case 'in-progress':
|
|
1259
|
+
// Processing is still ongoing, display partial results
|
|
1260
|
+
console.log('Processing...', partialData.response);
|
|
1261
|
+
break;
|
|
1262
|
+
case 'success':
|
|
1263
|
+
// Final result received
|
|
1264
|
+
console.log('Processing complete:', partialData.response);
|
|
1265
|
+
break;
|
|
1266
|
+
case 'failed':
|
|
1267
|
+
// Processing failed
|
|
1268
|
+
console.error('Processing failed:', partialData.message);
|
|
1269
|
+
break;
|
|
1270
|
+
case 'timeout':
|
|
1271
|
+
// Polling timed out
|
|
1272
|
+
console.warn('Polling timeout:', partialData.message);
|
|
1273
|
+
break;
|
|
1274
|
+
}
|
|
1275
|
+
});
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
- #### Callback Structure:
|
|
1279
|
+
|
|
1280
|
+
```ts
|
|
1281
|
+
{
|
|
1282
|
+
txn_id: string; // Transaction ID
|
|
1283
|
+
response: TGetStatusApiResponse | null; // The response structure is the same as returned by `pollSessionOutput` method
|
|
1284
|
+
status_code: number; // HTTP status code
|
|
1285
|
+
message: string; // Status message
|
|
1286
|
+
poll_status: 'in-progress' | 'success' | 'failed' | 'timeout'; // Current polling state
|
|
1287
|
+
}
|
|
1288
|
+
```
|
|
1289
|
+
|
|
1290
|
+
**When to use:**
|
|
1291
|
+
|
|
1292
|
+
- Set this callback before calling `pollSessionOutput` to receive real-time updates
|
|
1293
|
+
- Display partial transcription results to improve user experience
|
|
1294
|
+
- Show processing progress indicators
|
|
1295
|
+
- Handle intermediate template results
|
|
1296
|
+
|
|
1297
|
+
**Note:** This callback is triggered multiple times during polling - once for each poll attempt until processing completes or times out.
|
|
1298
|
+
|
|
1177
1299
|
### Error codes
|
|
1178
1300
|
|
|
1179
1301
|
| Error Code | Description |
|
package/dist/index.d.ts
CHANGED
|
@@ -21,18 +21,17 @@ declare class EkaScribe {
|
|
|
21
21
|
private audioBufferInstance;
|
|
22
22
|
private compatibilityManager;
|
|
23
23
|
private constructor();
|
|
24
|
-
static getInstance({ access_token, env, clientId,
|
|
24
|
+
static getInstance({ access_token, env, clientId, }: {
|
|
25
25
|
access_token?: string;
|
|
26
26
|
env?: 'PROD' | 'DEV';
|
|
27
27
|
clientId?: string;
|
|
28
|
-
clientEndpoint?: string;
|
|
29
28
|
}): EkaScribe;
|
|
30
29
|
resetInstance(): void;
|
|
31
30
|
getEkascribeConfig(): Promise<TGetConfigV2Response>;
|
|
32
31
|
updateAuthTokens({ access_token }: {
|
|
33
32
|
access_token: string;
|
|
34
33
|
}): void;
|
|
35
|
-
initTransaction(request: TPostTransactionInitRequest): Promise<TStartRecordingResponse>;
|
|
34
|
+
initTransaction(request: TPostTransactionInitRequest, sharedWorkerUrl?: string): Promise<TStartRecordingResponse>;
|
|
36
35
|
startRecording(): Promise<TStartRecordingResponse>;
|
|
37
36
|
reinitializeVad(): void;
|
|
38
37
|
destroyVad(): void;
|
|
@@ -55,7 +54,7 @@ declare class EkaScribe {
|
|
|
55
54
|
pollSessionOutput(request: {
|
|
56
55
|
txn_id: string;
|
|
57
56
|
max_polling_time?: number;
|
|
58
|
-
|
|
57
|
+
template_id?: string;
|
|
59
58
|
}): Promise<TPollingResponse>;
|
|
60
59
|
getSessionHistory({ txn_count }: {
|
|
61
60
|
txn_count: number;
|
|
@@ -122,11 +121,10 @@ declare enum ERROR_CODE {
|
|
|
122
121
|
|
|
123
122
|
declare type Gender = 'M' | 'F' | 'O';
|
|
124
123
|
|
|
125
|
-
export declare const getEkaScribeInstance: ({ access_token, env, clientId,
|
|
124
|
+
export declare const getEkaScribeInstance: ({ access_token, env, clientId, }: {
|
|
126
125
|
access_token?: string;
|
|
127
126
|
env?: "PROD" | "DEV";
|
|
128
127
|
clientId?: string;
|
|
129
|
-
clientEndpoint?: string;
|
|
130
128
|
}) => EkaScribe;
|
|
131
129
|
|
|
132
130
|
declare type TAudioChunksInfo = {
|
package/dist/index.mjs
CHANGED
|
@@ -38528,40 +38528,40 @@ class AudioFileManager {
|
|
|
38528
38528
|
updateAudioInfo(a) {
|
|
38529
38529
|
return this.audioChunks.push(a), this.audioChunks.length;
|
|
38530
38530
|
}
|
|
38531
|
-
createSharedWorkerInstance() {
|
|
38531
|
+
createSharedWorkerInstance(a) {
|
|
38532
38532
|
try {
|
|
38533
|
-
const
|
|
38534
|
-
this.sharedWorkerInstance =
|
|
38535
|
-
const
|
|
38536
|
-
return this.sharedWorkerInstance.port.onmessage = async (
|
|
38537
|
-
const
|
|
38538
|
-
switch (
|
|
38533
|
+
const s = new SharedWorker(a);
|
|
38534
|
+
this.sharedWorkerInstance = s;
|
|
38535
|
+
const n = EkaScribeStore$1.eventCallback;
|
|
38536
|
+
return this.sharedWorkerInstance.port.onmessage = async (r) => {
|
|
38537
|
+
const c = r.data;
|
|
38538
|
+
switch (c.action) {
|
|
38539
38539
|
case SHARED_WORKER_ACTION.CONFIGURE_AWS_SUCCESS: {
|
|
38540
|
-
|
|
38540
|
+
n && n({
|
|
38541
38541
|
callback_type: CALLBACK_TYPE.AWS_CONFIGURE_STATUS,
|
|
38542
38542
|
status: "success",
|
|
38543
|
-
message:
|
|
38543
|
+
message: c.message,
|
|
38544
38544
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
38545
38545
|
});
|
|
38546
38546
|
return;
|
|
38547
38547
|
}
|
|
38548
38548
|
case SHARED_WORKER_ACTION.CONFIGURE_AWS_ERROR: {
|
|
38549
|
-
|
|
38549
|
+
n && n({
|
|
38550
38550
|
callback_type: CALLBACK_TYPE.AWS_CONFIGURE_STATUS,
|
|
38551
38551
|
status: "error",
|
|
38552
|
-
message:
|
|
38552
|
+
message: c.message,
|
|
38553
38553
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
38554
38554
|
});
|
|
38555
38555
|
return;
|
|
38556
38556
|
}
|
|
38557
38557
|
case SHARED_WORKER_ACTION.UPLOAD_FILE_WITH_WORKER_SUCCESS: {
|
|
38558
38558
|
const {
|
|
38559
|
-
fileCount:
|
|
38560
|
-
chunkIndex:
|
|
38561
|
-
fileBlob:
|
|
38562
|
-
compressedAudioBuffer:
|
|
38563
|
-
} =
|
|
38564
|
-
|
|
38559
|
+
fileCount: u,
|
|
38560
|
+
chunkIndex: m,
|
|
38561
|
+
fileBlob: y,
|
|
38562
|
+
compressedAudioBuffer: l
|
|
38563
|
+
} = c.requestBody;
|
|
38564
|
+
n && l && n({
|
|
38565
38565
|
callback_type: CALLBACK_TYPE.FILE_UPLOAD_STATUS,
|
|
38566
38566
|
status: "info",
|
|
38567
38567
|
message: "Audioframes of chunk to store in IDB",
|
|
@@ -38569,57 +38569,57 @@ class AudioFileManager {
|
|
|
38569
38569
|
data: {
|
|
38570
38570
|
success: this.successfulUploads.length,
|
|
38571
38571
|
total: this.audioChunks.length,
|
|
38572
|
-
fileName:
|
|
38573
|
-
chunkData:
|
|
38572
|
+
fileName: u,
|
|
38573
|
+
chunkData: l
|
|
38574
38574
|
}
|
|
38575
|
-
}),
|
|
38576
|
-
...this.audioChunks[
|
|
38575
|
+
}), c.response.success ? (this.successfulUploads.push(u), m !== -1 && (this.audioChunks[m] = {
|
|
38576
|
+
...this.audioChunks[m],
|
|
38577
38577
|
audioFrames: void 0,
|
|
38578
38578
|
fileBlob: void 0,
|
|
38579
38579
|
status: "success",
|
|
38580
|
-
response:
|
|
38581
|
-
}),
|
|
38580
|
+
response: c.response.success
|
|
38581
|
+
}), n && n({
|
|
38582
38582
|
callback_type: CALLBACK_TYPE.FILE_UPLOAD_STATUS,
|
|
38583
38583
|
status: "success",
|
|
38584
|
-
message:
|
|
38584
|
+
message: c.response.success,
|
|
38585
38585
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
38586
38586
|
data: {
|
|
38587
38587
|
success: this.successfulUploads.length,
|
|
38588
38588
|
total: this.audioChunks.length,
|
|
38589
38589
|
is_uploaded: !0
|
|
38590
38590
|
}
|
|
38591
|
-
})) : (
|
|
38591
|
+
})) : (n && n({
|
|
38592
38592
|
callback_type: CALLBACK_TYPE.FILE_UPLOAD_STATUS,
|
|
38593
38593
|
status: "error",
|
|
38594
|
-
message:
|
|
38594
|
+
message: c.response.error || "Upload failed",
|
|
38595
38595
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
38596
38596
|
error: {
|
|
38597
|
-
code:
|
|
38598
|
-
msg:
|
|
38599
|
-
details:
|
|
38597
|
+
code: c.response.code,
|
|
38598
|
+
msg: c.response.error,
|
|
38599
|
+
details: c.response.errorCode
|
|
38600
38600
|
},
|
|
38601
38601
|
data: {
|
|
38602
|
-
fileName:
|
|
38602
|
+
fileName: u,
|
|
38603
38603
|
is_uploaded: !1
|
|
38604
38604
|
}
|
|
38605
|
-
}),
|
|
38606
|
-
...this.audioChunks[
|
|
38607
|
-
fileBlob:
|
|
38605
|
+
}), m !== -1 && (this.audioChunks[m] = {
|
|
38606
|
+
...this.audioChunks[m],
|
|
38607
|
+
fileBlob: y,
|
|
38608
38608
|
audioFrames: void 0,
|
|
38609
38609
|
status: "failure",
|
|
38610
|
-
response:
|
|
38611
|
-
}),
|
|
38610
|
+
response: c.response.error || "Upload failed"
|
|
38611
|
+
}), c.response.errorCode === "ExpiredToken" && this.setupAWSConfiguration({
|
|
38612
38612
|
is_shared_worker: !0
|
|
38613
38613
|
}));
|
|
38614
38614
|
}
|
|
38615
38615
|
}
|
|
38616
|
-
},
|
|
38617
|
-
} catch (
|
|
38618
|
-
const
|
|
38619
|
-
return
|
|
38616
|
+
}, s.port.start(), !0;
|
|
38617
|
+
} catch (s) {
|
|
38618
|
+
const n = s instanceof Error ? s.message : String(s);
|
|
38619
|
+
return n.includes("SecurityError") || n.includes("Failed to construct") ? console.error(
|
|
38620
38620
|
"Error creating shared worker instance: CORS/Same-origin policy violation. The SharedWorker script must be served from the same origin as your application, or the server must allow cross-origin access with proper CORS headers. Falling back to non-worker upload method.",
|
|
38621
|
-
|
|
38622
|
-
) : console.error("Error creating shared worker instance:",
|
|
38621
|
+
s
|
|
38622
|
+
) : console.error("Error creating shared worker instance:", s), !1;
|
|
38623
38623
|
}
|
|
38624
38624
|
}
|
|
38625
38625
|
async setupAWSConfiguration({ is_shared_worker: a }) {
|
|
@@ -38753,20 +38753,7 @@ class AudioFileManager {
|
|
|
38753
38753
|
};
|
|
38754
38754
|
}
|
|
38755
38755
|
async uploadAudioToS3({ audioFrames: a, fileName: s, chunkIndex: n }) {
|
|
38756
|
-
|
|
38757
|
-
console.log("Shared Workers are NOT supported in this browser."), await this.uploadAudioToS3WithoutWorker({ audioFrames: a, fileName: s, chunkIndex: n });
|
|
38758
|
-
else {
|
|
38759
|
-
if (console.log("Shared Workers are supported in this browser."), !this.sharedWorkerInstance) {
|
|
38760
|
-
const r = this.createSharedWorkerInstance();
|
|
38761
|
-
if (console.log(r, "worker created"), !r) {
|
|
38762
|
-
console.warn(
|
|
38763
|
-
"Failed to create SharedWorker instance. Falling back to non-worker upload method."
|
|
38764
|
-
), await this.uploadAudioToS3WithoutWorker({ audioFrames: a, fileName: s, chunkIndex: n });
|
|
38765
|
-
return;
|
|
38766
|
-
}
|
|
38767
|
-
}
|
|
38768
|
-
await this.uploadAudioToS3WithWorker({ audioFrames: a, fileName: s, chunkIndex: n });
|
|
38769
|
-
}
|
|
38756
|
+
typeof SharedWorker > "u" || !SharedWorker || !this.sharedWorkerInstance ? (console.log("Shared Workers are NOT supported in this browser."), await this.uploadAudioToS3WithoutWorker({ audioFrames: a, fileName: s, chunkIndex: n })) : (console.log("Shared Workers are supported in this browser."), await this.uploadAudioToS3WithWorker({ audioFrames: a, fileName: s, chunkIndex: n }));
|
|
38770
38757
|
}
|
|
38771
38758
|
async uploadAudioToS3WithWorker({
|
|
38772
38759
|
audioFrames: a,
|
|
@@ -54204,7 +54191,7 @@ const decodeApiResponse = (i) => {
|
|
|
54204
54191
|
}, pollOutputSummary = async ({
|
|
54205
54192
|
txn_id: i,
|
|
54206
54193
|
max_polling_time: a = 120 * 1e3,
|
|
54207
|
-
|
|
54194
|
+
template_id: s
|
|
54208
54195
|
}) => {
|
|
54209
54196
|
const n = EkaScribeStore$1.partialResultCallback, r = (c, u, m, y) => {
|
|
54210
54197
|
const l = {
|
|
@@ -54251,7 +54238,7 @@ const decodeApiResponse = (i) => {
|
|
|
54251
54238
|
}
|
|
54252
54239
|
} else
|
|
54253
54240
|
m = 0;
|
|
54254
|
-
return y();
|
|
54241
|
+
return y(s ? `template_id=${s}` : "");
|
|
54255
54242
|
}
|
|
54256
54243
|
return r(
|
|
54257
54244
|
t,
|
|
@@ -54268,7 +54255,7 @@ const decodeApiResponse = (i) => {
|
|
|
54268
54255
|
);
|
|
54269
54256
|
}
|
|
54270
54257
|
};
|
|
54271
|
-
return y(s ?
|
|
54258
|
+
return y(s ? `template_id=${s}` : "");
|
|
54272
54259
|
} catch (c) {
|
|
54273
54260
|
return c instanceof Error && c.name === "AbortError" ? r(-1, null, "Request was aborted due to timeout.", "timeout") : r(
|
|
54274
54261
|
-1,
|
|
@@ -54827,14 +54814,13 @@ const Ur = class Ur {
|
|
|
54827
54814
|
static getInstance({
|
|
54828
54815
|
access_token: a,
|
|
54829
54816
|
env: s,
|
|
54830
|
-
clientId: n
|
|
54831
|
-
clientEndpoint: r
|
|
54817
|
+
clientId: n
|
|
54832
54818
|
}) {
|
|
54833
54819
|
return setEnv({
|
|
54834
54820
|
...a ? { auth_token: a } : {},
|
|
54835
54821
|
...s ? { env: s } : {},
|
|
54836
54822
|
...n ? { clientId: n } : {}
|
|
54837
|
-
}),
|
|
54823
|
+
}), Ur.instance || (Ur.instance = new Ur()), Ur.instance;
|
|
54838
54824
|
}
|
|
54839
54825
|
// Method to reset the singleton instance (useful for testing)
|
|
54840
54826
|
resetInstance() {
|
|
@@ -54848,15 +54834,15 @@ const Ur = class Ur {
|
|
|
54848
54834
|
auth_token: a
|
|
54849
54835
|
});
|
|
54850
54836
|
}
|
|
54851
|
-
async initTransaction(a) {
|
|
54852
|
-
EkaScribeStore$1.resetStore(), this.audioFileManagerInstance = new AudioFileManager(), EkaScribeStore$1.audioFileManagerInstance = this.audioFileManagerInstance, this.audioBufferInstance = new AudioBufferManager(SAMPLING_RATE, AUDIO_BUFFER_SIZE_IN_S), EkaScribeStore$1.audioBufferInstance = this.audioBufferInstance, this.vadInstance = new VadWebClient(
|
|
54837
|
+
async initTransaction(a, s) {
|
|
54838
|
+
EkaScribeStore$1.resetStore(), this.audioFileManagerInstance = new AudioFileManager(), EkaScribeStore$1.audioFileManagerInstance = this.audioFileManagerInstance, s && this.audioFileManagerInstance.createSharedWorkerInstance(s), this.audioBufferInstance = new AudioBufferManager(SAMPLING_RATE, AUDIO_BUFFER_SIZE_IN_S), EkaScribeStore$1.audioBufferInstance = this.audioBufferInstance, this.vadInstance = new VadWebClient(
|
|
54853
54839
|
PREF_CHUNK_LENGTH,
|
|
54854
54840
|
DESP_CHUNK_LENGTH,
|
|
54855
54841
|
MAX_CHUNK_LENGTH,
|
|
54856
54842
|
FRAME_RATE
|
|
54857
54843
|
), EkaScribeStore$1.vadInstance = this.vadInstance, console.log("Initialising SDK Instances ", EkaScribeStore$1);
|
|
54858
|
-
const
|
|
54859
|
-
return console.log(
|
|
54844
|
+
const n = await initialiseTransaction(a);
|
|
54845
|
+
return console.log(n, "initTransactionResponse"), n;
|
|
54860
54846
|
}
|
|
54861
54847
|
async startRecording() {
|
|
54862
54848
|
const a = await startVoiceRecording();
|
|
@@ -55123,9 +55109,8 @@ let EkaScribe = Ur;
|
|
|
55123
55109
|
const getEkaScribeInstance = ({
|
|
55124
55110
|
access_token: i,
|
|
55125
55111
|
env: a,
|
|
55126
|
-
clientId: s
|
|
55127
|
-
|
|
55128
|
-
}) => EkaScribe.getInstance({ access_token: i, env: a, clientId: s, clientEndpoint: n });
|
|
55112
|
+
clientId: s
|
|
55113
|
+
}) => EkaScribe.getInstance({ access_token: i, env: a, clientId: s });
|
|
55129
55114
|
export {
|
|
55130
55115
|
getEkaScribeInstance
|
|
55131
55116
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eka-care/ekascribe-ts-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.47",
|
|
4
4
|
"description": "EkaScribe TypeScript SDK - Modern ES2020 build",
|
|
5
5
|
"main": "dist/index.mjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"clean": "rm -rf dist",
|
|
29
29
|
"build:main": "vite build",
|
|
30
30
|
"build:worker": "vite build --config vite.worker.config.ts",
|
|
31
|
-
"build": "yarn clean && yarn build:main && yarn build:worker
|
|
31
|
+
"build": "yarn clean && yarn build:main && yarn build:worker",
|
|
32
32
|
"prepublishOnly": "yarn build"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|