med-scribe-alliance-ts-sdk 2.0.38 → 2.0.40
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 +3 -2
- package/dist/index.d.ts +12 -8
- package/dist/index.mjs +101 -98
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -363,6 +363,7 @@ interface RecordingOptions {
|
|
|
363
363
|
deviceId?: string; // Specific microphone device ID
|
|
364
364
|
sessionMode?: string; // 'consultation' | 'dictation'
|
|
365
365
|
patientDetails?: PatientDetails; // Patient info
|
|
366
|
+
version?: string; // Optional API version (sent as a `version` query param on create-session)
|
|
366
367
|
txnId?: string; // External transaction ID
|
|
367
368
|
}
|
|
368
369
|
```
|
|
@@ -395,8 +396,8 @@ interface RecordingOptions {
|
|
|
395
396
|
|
|
396
397
|
| Method | Returns | Description |
|
|
397
398
|
|---|---|---|
|
|
398
|
-
| `createSession(request)` | `SDKResult<CreateSessionResponse>` | Create a session without starting a recording. |
|
|
399
|
-
| `getSessionStatus(sessionId?, options?)` | `SDKResult<GetSessionStatusResponse>` | Get status. Supports `poll` and `
|
|
399
|
+
| `createSession(request, version?)` | `SDKResult<CreateSessionResponse>` | Create a session without starting a recording. Optional `version` is sent as a `version` query param. |
|
|
400
|
+
| `getSessionStatus(sessionId?, options?)` | `SDKResult<GetSessionStatusResponse>` | Get status. Supports `poll`, `templateId`, and `version` options (`version` sent as a query param). |
|
|
400
401
|
| `getCurrentSession()` | `CreateSessionResponse \| null` | Get the active session if any. |
|
|
401
402
|
| `updateSession(request, sessionId?)` | `SDKResult<PatchSessionResponse>` | Patch session (patient details, status, etc.). |
|
|
402
403
|
| `processTemplate(templateId, sessionId?)` | `SDKResult<ProcessTemplateResponse>` | Trigger processing for a specific template. |
|
package/dist/index.d.ts
CHANGED
|
@@ -493,6 +493,8 @@ export interface RecordingOptions {
|
|
|
493
493
|
sessionMode?: string;
|
|
494
494
|
patientDetails?: PatientDetails;
|
|
495
495
|
sessionId?: string;
|
|
496
|
+
/** Optional API version; sent as a `version` query param on the create-session request. */
|
|
497
|
+
version?: string;
|
|
496
498
|
}
|
|
497
499
|
export interface RecorderConfig {
|
|
498
500
|
accessToken?: string;
|
|
@@ -771,7 +773,7 @@ export declare class ScribeClient {
|
|
|
771
773
|
* the SDK runs one internal retry pass; if files still fail, the session
|
|
772
774
|
* is NOT ended and the result reports `sessionEnded: false`.
|
|
773
775
|
*/
|
|
774
|
-
endRecording(): Promise<SDKResult<EndRecordingResult>>;
|
|
776
|
+
endRecording(version?: string): Promise<SDKResult<EndRecordingResult>>;
|
|
775
777
|
/**
|
|
776
778
|
* Retry uploading audio files that failed during the last recording.
|
|
777
779
|
*
|
|
@@ -779,7 +781,7 @@ export declare class ScribeClient {
|
|
|
779
781
|
* `hasFailedUploads()` is true). After retrying, call `endSession()` to
|
|
780
782
|
* finalize. Retry context is cleared on `reset()` or the next `startRecording()`.
|
|
781
783
|
*/
|
|
782
|
-
retryFailedUploads(): Promise<SDKResult<RetryUploadResult>>;
|
|
784
|
+
retryFailedUploads(version?: string): Promise<SDKResult<RetryUploadResult>>;
|
|
783
785
|
/**
|
|
784
786
|
* Check if there are failed uploads from the last recording that can be retried.
|
|
785
787
|
*/
|
|
@@ -807,7 +809,7 @@ export declare class ScribeClient {
|
|
|
807
809
|
/**
|
|
808
810
|
* Create a session directly (without starting a recording).
|
|
809
811
|
*/
|
|
810
|
-
createSession(sessionRequest: CreateSessionRequest): Promise<SDKResult<CreateSessionResponse>>;
|
|
812
|
+
createSession(sessionRequest: CreateSessionRequest, version?: string): Promise<SDKResult<CreateSessionResponse>>;
|
|
811
813
|
/**
|
|
812
814
|
* End a session directly.
|
|
813
815
|
*/
|
|
@@ -820,10 +822,12 @@ export declare class ScribeClient {
|
|
|
820
822
|
* terminal state (completed, partial, failed, expired) or times out.
|
|
821
823
|
*
|
|
822
824
|
* Pass `templateId` to filter status for a specific template.
|
|
825
|
+
* Pass `version` to target a specific API version (attached as a query param).
|
|
823
826
|
*/
|
|
824
827
|
getSessionStatus(sessionId?: string, options?: {
|
|
825
828
|
poll?: PollOptions;
|
|
826
829
|
templateId?: string;
|
|
830
|
+
version?: string;
|
|
827
831
|
}): Promise<SDKResult<GetSessionStatusResponse>>;
|
|
828
832
|
/**
|
|
829
833
|
* Get the current active session, if any.
|
|
@@ -1058,7 +1062,7 @@ export declare class SessionManager {
|
|
|
1058
1062
|
* Create a new scribe session.
|
|
1059
1063
|
* Validates the request structure, sends to server, validates response.
|
|
1060
1064
|
*/
|
|
1061
|
-
createSession(baseUrl: string, request: CreateSessionRequest): Promise<ApiCallResult<CreateSessionResponse>>;
|
|
1065
|
+
createSession(baseUrl: string, request: CreateSessionRequest, version?: string): Promise<ApiCallResult<CreateSessionResponse>>;
|
|
1062
1066
|
/**
|
|
1063
1067
|
* End an active session.
|
|
1064
1068
|
* If no sessionId is provided, ends the current session.
|
|
@@ -1069,7 +1073,7 @@ export declare class SessionManager {
|
|
|
1069
1073
|
* If no sessionId is provided, queries the current session.
|
|
1070
1074
|
* Pass templateId to filter status for a specific template.
|
|
1071
1075
|
*/
|
|
1072
|
-
getSessionStatus(baseUrl: string, sessionId?: string, templateId?: string): Promise<ApiCallResult<GetSessionStatusResponse>>;
|
|
1076
|
+
getSessionStatus(baseUrl: string, sessionId?: string, templateId?: string, version?: string): Promise<ApiCallResult<GetSessionStatusResponse>>;
|
|
1073
1077
|
/**
|
|
1074
1078
|
* Patch an existing session (e.g., update user_status or processing_status).
|
|
1075
1079
|
*/
|
|
@@ -1084,7 +1088,7 @@ export declare class SessionManager {
|
|
|
1084
1088
|
* (completed, partial, or failed) or the max attempts are exhausted.
|
|
1085
1089
|
* Pass templateId to filter the returned status for a specific template.
|
|
1086
1090
|
*/
|
|
1087
|
-
pollForCompletion(baseUrl: string, sessionId?: string, options?: PollOptions, templateId?: string): Promise<ApiCallResult<GetSessionStatusResponse>>;
|
|
1091
|
+
pollForCompletion(baseUrl: string, sessionId?: string, options?: PollOptions, templateId?: string, version?: string): Promise<ApiCallResult<GetSessionStatusResponse>>;
|
|
1088
1092
|
/**
|
|
1089
1093
|
* Get the current active session, if any.
|
|
1090
1094
|
*/
|
|
@@ -1171,7 +1175,7 @@ export declare class RecordingManager {
|
|
|
1171
1175
|
* Resume a paused recording.
|
|
1172
1176
|
*/
|
|
1173
1177
|
resume(): void;
|
|
1174
|
-
stop(): Promise<ApiCallResult<EndRecordingResult>>;
|
|
1178
|
+
stop(version?: string): Promise<ApiCallResult<EndRecordingResult>>;
|
|
1175
1179
|
/**
|
|
1176
1180
|
* End the session, dispatch onSessionEvent, and return the response.
|
|
1177
1181
|
* Called from stop() (auto-finalize) and finalizeAfterExternalEndSession()
|
|
@@ -1221,7 +1225,7 @@ export declare class RecordingManager {
|
|
|
1221
1225
|
* Each file is re-uploaded via transport.request() with retry logic.
|
|
1222
1226
|
* Successfully retried files are removed from the retry context.
|
|
1223
1227
|
*/
|
|
1224
|
-
retryFailedUploads(): Promise<ApiCallResult<RetryUploadResult>>;
|
|
1228
|
+
retryFailedUploads(version?: string): Promise<ApiCallResult<RetryUploadResult>>;
|
|
1225
1229
|
/**
|
|
1226
1230
|
* Create the appropriate recorder based on upload type.
|
|
1227
1231
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -277,7 +277,8 @@ var r = "/.well-known/medscribealliance", i = 3600 * 1e3, a = /* @__PURE__ */ fu
|
|
|
277
277
|
gender: e.string().optional(),
|
|
278
278
|
mobile: e.number().optional()
|
|
279
279
|
}).optional(),
|
|
280
|
-
sessionId: e.string().optional()
|
|
280
|
+
sessionId: e.string().optional(),
|
|
281
|
+
version: e.string().optional()
|
|
281
282
|
}), N = class {
|
|
282
283
|
validateDiscoveryResponse(e) {
|
|
283
284
|
this.parseWithValidationError(ae, e, "Invalid discovery response");
|
|
@@ -748,19 +749,19 @@ var z = class {
|
|
|
748
749
|
constructor(e, t, n = !1) {
|
|
749
750
|
this.currentSession = null, this.transport = e, this.validator = t, this.debug = n;
|
|
750
751
|
}
|
|
751
|
-
async createSession(e, t) {
|
|
752
|
+
async createSession(e, t, n) {
|
|
752
753
|
try {
|
|
753
754
|
this.validator.validateCreateSessionRequest(t);
|
|
754
|
-
let
|
|
755
|
-
this.debug && console.log("[ScribeSDK] Creating session:",
|
|
756
|
-
let
|
|
755
|
+
let r = `${e}/sessions`;
|
|
756
|
+
n && (r += `?version=${encodeURIComponent(n)}`), this.debug && console.log("[ScribeSDK] Creating session:", r);
|
|
757
|
+
let i = await this.transport.request({
|
|
757
758
|
method: "POST",
|
|
758
|
-
url:
|
|
759
|
+
url: r,
|
|
759
760
|
body: t
|
|
760
761
|
});
|
|
761
|
-
return this.validator.validateCreateSessionResponse(
|
|
762
|
-
data:
|
|
763
|
-
httpStatus:
|
|
762
|
+
return this.validator.validateCreateSessionResponse(i.data), this.currentSession = i.data, this.debug && console.log("[ScribeSDK] Session created:", i.data.session_id), {
|
|
763
|
+
data: i.data,
|
|
764
|
+
httpStatus: i.status
|
|
764
765
|
};
|
|
765
766
|
} catch (e) {
|
|
766
767
|
throw e instanceof v ? e : new v(`Failed to create session: ${e instanceof Error ? e.message : "Unknown error"}`);
|
|
@@ -786,21 +787,23 @@ var z = class {
|
|
|
786
787
|
throw e instanceof v ? e : new v(`Failed to end session: ${e instanceof Error ? e.message : "Unknown error"}`);
|
|
787
788
|
}
|
|
788
789
|
}
|
|
789
|
-
async getSessionStatus(e, t, n) {
|
|
790
|
+
async getSessionStatus(e, t, n, r) {
|
|
790
791
|
try {
|
|
791
|
-
let
|
|
792
|
-
if (!
|
|
793
|
-
this.validator.validateSessionId(
|
|
794
|
-
let
|
|
795
|
-
n && (
|
|
796
|
-
let a =
|
|
792
|
+
let i = t ?? this.currentSession?.session_id;
|
|
793
|
+
if (!i) throw new v("No active session. Provide a sessionId or start a session first.");
|
|
794
|
+
this.validator.validateSessionId(i);
|
|
795
|
+
let a = new URLSearchParams();
|
|
796
|
+
n && a.set("template_id", n), r && a.set("version", r);
|
|
797
|
+
let o = a.toString(), s = o ? `${e}/sessions/${i}?${o}` : `${e}/sessions/${i}`;
|
|
798
|
+
this.debug && console.log("[ScribeSDK] Getting session status:", i);
|
|
799
|
+
let c = await this.transport.request({
|
|
797
800
|
method: "GET",
|
|
798
|
-
url:
|
|
801
|
+
url: s,
|
|
799
802
|
acceptStatuses: [410]
|
|
800
803
|
});
|
|
801
|
-
return this.validator.validateGetSessionStatusResponse(
|
|
802
|
-
data:
|
|
803
|
-
httpStatus:
|
|
804
|
+
return this.validator.validateGetSessionStatusResponse(c.data), this.debug && console.log("[ScribeSDK] Session status:", i, c.data.status), {
|
|
805
|
+
data: c.data,
|
|
806
|
+
httpStatus: c.status
|
|
804
807
|
};
|
|
805
808
|
} catch (e) {
|
|
806
809
|
throw e instanceof v ? e : new v(`Failed to get session status: ${e instanceof Error ? e.message : "Unknown error"}`);
|
|
@@ -845,42 +848,42 @@ var z = class {
|
|
|
845
848
|
throw e instanceof v ? e : new v(`Failed to process template: ${e instanceof Error ? e.message : "Unknown error"}`);
|
|
846
849
|
}
|
|
847
850
|
}
|
|
848
|
-
async pollForCompletion(e, t, n, r) {
|
|
851
|
+
async pollForCompletion(e, t, n, r, i) {
|
|
849
852
|
try {
|
|
850
|
-
let
|
|
851
|
-
if (!
|
|
852
|
-
let
|
|
853
|
-
this.debug && console.log("[ScribeSDK] Polling for completion:",
|
|
854
|
-
maxAttempts:
|
|
855
|
-
intervalMs:
|
|
856
|
-
timeoutMs:
|
|
853
|
+
let a = t ?? this.currentSession?.session_id;
|
|
854
|
+
if (!a) throw new v("No active session. Provide a sessionId or start a session first.");
|
|
855
|
+
let o = n?.maxAttempts ?? 60, s = n?.intervalMs ?? 2e3, c = n?.timeoutMs, l = c !== void 0 && c > 0 ? Date.now() + c : void 0;
|
|
856
|
+
this.debug && console.log("[ScribeSDK] Polling for completion:", a, {
|
|
857
|
+
maxAttempts: o,
|
|
858
|
+
intervalMs: s,
|
|
859
|
+
timeoutMs: c
|
|
857
860
|
});
|
|
858
|
-
for (let t = 1; t <=
|
|
859
|
-
if (n?.signal?.aborted) throw new v("Polling was aborted", "polling_aborted", void 0, { session_id:
|
|
860
|
-
if (
|
|
861
|
-
session_id:
|
|
862
|
-
timeout_ms:
|
|
861
|
+
for (let t = 1; t <= o; t++) {
|
|
862
|
+
if (n?.signal?.aborted) throw new v("Polling was aborted", "polling_aborted", void 0, { session_id: a });
|
|
863
|
+
if (l !== void 0 && Date.now() >= l) throw new v(`Polling timed out after ${c}ms for session '${a}'`, "polling_timeout", void 0, {
|
|
864
|
+
session_id: a,
|
|
865
|
+
timeout_ms: c
|
|
863
866
|
});
|
|
864
|
-
let
|
|
867
|
+
let u = await this.getSessionStatus(e, a, r, i), d = u.data;
|
|
865
868
|
if (n?.onProgress) try {
|
|
866
|
-
n.onProgress(
|
|
869
|
+
n.onProgress(d);
|
|
867
870
|
} catch (e) {
|
|
868
871
|
console.error("[ScribeSDK] Error in poll onProgress callback:", e);
|
|
869
872
|
}
|
|
870
|
-
if (this.isTerminalStatus(
|
|
871
|
-
if (t <
|
|
872
|
-
let e =
|
|
873
|
-
if (
|
|
874
|
-
let t =
|
|
873
|
+
if (this.isTerminalStatus(d.status)) return this.debug && console.log("[ScribeSDK] Poll complete:", a, d.status, `(attempt ${t})`), u;
|
|
874
|
+
if (t < o) {
|
|
875
|
+
let e = s;
|
|
876
|
+
if (l !== void 0) {
|
|
877
|
+
let t = l - Date.now();
|
|
875
878
|
if (t <= 0) continue;
|
|
876
|
-
e = Math.min(
|
|
879
|
+
e = Math.min(s, t);
|
|
877
880
|
}
|
|
878
881
|
await this.sleepWithAbort(e, n?.signal);
|
|
879
882
|
}
|
|
880
883
|
}
|
|
881
|
-
throw new v(`Polling timed out after ${
|
|
882
|
-
session_id:
|
|
883
|
-
max_attempts:
|
|
884
|
+
throw new v(`Polling timed out after ${o} attempts for session '${a}'`, "polling_timeout", void 0, {
|
|
885
|
+
session_id: a,
|
|
886
|
+
max_attempts: o
|
|
884
887
|
});
|
|
885
888
|
} catch (e) {
|
|
886
889
|
throw e instanceof v ? e : new v(`Failed to poll session: ${e instanceof Error ? e.message : "Unknown error"}`);
|
|
@@ -1725,8 +1728,8 @@ var Se = class {
|
|
|
1725
1728
|
try {
|
|
1726
1729
|
let a, s;
|
|
1727
1730
|
try {
|
|
1728
|
-
let
|
|
1729
|
-
a =
|
|
1731
|
+
let n = await this.sessionManager.createSession(e, o, t.version);
|
|
1732
|
+
a = n.data, s = n.httpStatus;
|
|
1730
1733
|
} catch (e) {
|
|
1731
1734
|
throw r === this._startGeneration && this.dispatchStartError(m.TRANSPORT_ERROR, g.SESSION_CREATION_FAILED, e), e;
|
|
1732
1735
|
}
|
|
@@ -1855,7 +1858,7 @@ var Se = class {
|
|
|
1855
1858
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1856
1859
|
}), this.config.debug && console.log("[ScribeSDK] Recording resumed"));
|
|
1857
1860
|
}
|
|
1858
|
-
async stop() {
|
|
1861
|
+
async stop(e) {
|
|
1859
1862
|
if (!this.recorder || !this._isRecording) return {
|
|
1860
1863
|
data: {
|
|
1861
1864
|
failedUploads: [],
|
|
@@ -1864,13 +1867,13 @@ var Se = class {
|
|
|
1864
1867
|
},
|
|
1865
1868
|
httpStatus: void 0
|
|
1866
1869
|
};
|
|
1867
|
-
let
|
|
1870
|
+
let t = !1, n;
|
|
1868
1871
|
try {
|
|
1869
|
-
let
|
|
1872
|
+
let r = await this.recorder.stop();
|
|
1870
1873
|
this.preserveRetryContext(), this._isRecording = !1;
|
|
1871
|
-
let
|
|
1872
|
-
if (
|
|
1873
|
-
|
|
1874
|
+
let i = r.failedUploads;
|
|
1875
|
+
if (i.length > 0) try {
|
|
1876
|
+
i = (await this.retryFailedUploads(e)).data.stillFailed;
|
|
1874
1877
|
} catch (e) {
|
|
1875
1878
|
console.error("[ScribeSDK] Internal retry pass failed:", e), this.callbackRegistry.dispatch("onError", {
|
|
1876
1879
|
type: m.TRANSPORT_ERROR,
|
|
@@ -1881,26 +1884,26 @@ var Se = class {
|
|
|
1881
1884
|
}
|
|
1882
1885
|
});
|
|
1883
1886
|
}
|
|
1884
|
-
let
|
|
1885
|
-
failedUploads:
|
|
1886
|
-
totalFiles:
|
|
1887
|
+
let a = {
|
|
1888
|
+
failedUploads: i,
|
|
1889
|
+
totalFiles: r.totalFiles,
|
|
1887
1890
|
sessionEnded: !1
|
|
1888
1891
|
};
|
|
1889
|
-
if (
|
|
1890
|
-
let
|
|
1891
|
-
|
|
1892
|
+
if (i.length === 0 && this.activeSession) {
|
|
1893
|
+
let e = await this.finalizeSession(r.totalFiles, r.totalFiles);
|
|
1894
|
+
e && (a.sessionEnded = !0, a.endSessionResponse = e.data, n = e.httpStatus, t = !0);
|
|
1892
1895
|
}
|
|
1893
1896
|
return this.callbackRegistry.dispatch("onRecordingStateChange", {
|
|
1894
1897
|
type: u.ENDED,
|
|
1895
1898
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1896
|
-
data:
|
|
1899
|
+
data: a
|
|
1897
1900
|
}), this.config.debug && console.log("[ScribeSDK] Recording stopped:", {
|
|
1898
|
-
totalFiles:
|
|
1899
|
-
failedUploads:
|
|
1900
|
-
sessionEnded:
|
|
1901
|
+
totalFiles: a.totalFiles,
|
|
1902
|
+
failedUploads: a.failedUploads.length,
|
|
1903
|
+
sessionEnded: a.sessionEnded
|
|
1901
1904
|
}), {
|
|
1902
|
-
data:
|
|
1903
|
-
httpStatus:
|
|
1905
|
+
data: a,
|
|
1906
|
+
httpStatus: n
|
|
1904
1907
|
};
|
|
1905
1908
|
} catch (e) {
|
|
1906
1909
|
return console.error("[ScribeSDK] Error stopping recording:", e), this.callbackRegistry.dispatch("onError", {
|
|
@@ -1919,7 +1922,7 @@ var Se = class {
|
|
|
1919
1922
|
httpStatus: void 0
|
|
1920
1923
|
};
|
|
1921
1924
|
} finally {
|
|
1922
|
-
|
|
1925
|
+
t ? this.cleanupRecordingState() : this.partialCleanupAfterFailedFinalize();
|
|
1923
1926
|
}
|
|
1924
1927
|
}
|
|
1925
1928
|
async finalizeSession(e, t) {
|
|
@@ -1985,7 +1988,7 @@ var Se = class {
|
|
|
1985
1988
|
finalizeAfterExternalEndSession(e) {
|
|
1986
1989
|
this.activeSession && this.activeSession.session_id === e && (this.activeSession = null, this.activeBaseUrl = "", this.retryContext = null);
|
|
1987
1990
|
}
|
|
1988
|
-
async retryFailedUploads() {
|
|
1991
|
+
async retryFailedUploads(e) {
|
|
1989
1992
|
if (this._isRecording) throw new v("Cannot retry uploads while recording is active.");
|
|
1990
1993
|
if (!this.retryContext || this.retryContext.failedChunks.length === 0) return {
|
|
1991
1994
|
data: {
|
|
@@ -1995,47 +1998,47 @@ var Se = class {
|
|
|
1995
1998
|
},
|
|
1996
1999
|
httpStatus: void 0
|
|
1997
2000
|
};
|
|
1998
|
-
let { storageProvider:
|
|
2001
|
+
let { storageProvider: t, failedChunks: n } = this.retryContext, r = n.length, i = [], a = 0, o = this.retryContext.upload;
|
|
1999
2002
|
try {
|
|
2000
|
-
let
|
|
2001
|
-
if (
|
|
2002
|
-
let
|
|
2003
|
-
|
|
2003
|
+
let t = this.activeSession?.session_id;
|
|
2004
|
+
if (t) {
|
|
2005
|
+
let n = await this.sessionManager.getSessionStatus(this.activeBaseUrl, t, void 0, e);
|
|
2006
|
+
n.data.upload_url && (o = n.data.upload_url, this.retryContext.upload = o);
|
|
2004
2007
|
}
|
|
2005
2008
|
} catch (e) {
|
|
2006
2009
|
this.config.debug && console.log("[ScribeSDK] Failed to refresh upload_url, using existing:", e);
|
|
2007
2010
|
}
|
|
2008
|
-
this.config.debug && console.log(`[ScribeSDK] Retrying ${
|
|
2009
|
-
for (let
|
|
2011
|
+
this.config.debug && console.log(`[ScribeSDK] Retrying ${r} failed uploads`);
|
|
2012
|
+
for (let e of n) try {
|
|
2010
2013
|
await Y(this.transport, {
|
|
2011
|
-
fileName:
|
|
2012
|
-
blob:
|
|
2013
|
-
upload:
|
|
2014
|
-
storageProvider:
|
|
2014
|
+
fileName: e.fileName,
|
|
2015
|
+
blob: e.blob,
|
|
2016
|
+
upload: o,
|
|
2017
|
+
storageProvider: t,
|
|
2015
2018
|
maxRetries: 0
|
|
2016
|
-
}),
|
|
2019
|
+
}), a++, this.callbackRegistry.dispatch("onUploadEvent", {
|
|
2017
2020
|
type: f.PROGRESS,
|
|
2018
2021
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2019
2022
|
data: {
|
|
2020
|
-
successCount:
|
|
2021
|
-
totalCount:
|
|
2023
|
+
successCount: a,
|
|
2024
|
+
totalCount: r
|
|
2022
2025
|
}
|
|
2023
|
-
}), this.config.debug && console.log(`[ScribeSDK] Retry succeeded: ${
|
|
2024
|
-
} catch (
|
|
2025
|
-
|
|
2026
|
+
}), this.config.debug && console.log(`[ScribeSDK] Retry succeeded: ${e.fileName}`);
|
|
2027
|
+
} catch (t) {
|
|
2028
|
+
i.push(e.fileName), this.callbackRegistry.dispatch("onUploadEvent", {
|
|
2026
2029
|
type: f.FAILED,
|
|
2027
2030
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2028
2031
|
data: {
|
|
2029
|
-
fileName:
|
|
2030
|
-
error:
|
|
2032
|
+
fileName: e.fileName,
|
|
2033
|
+
error: t instanceof Error ? t.message : "Retry failed"
|
|
2031
2034
|
}
|
|
2032
|
-
}), this.config.debug && console.log(`[ScribeSDK] Retry failed: ${
|
|
2035
|
+
}), this.config.debug && console.log(`[ScribeSDK] Retry failed: ${e.fileName}`, t);
|
|
2033
2036
|
}
|
|
2034
|
-
return
|
|
2037
|
+
return i.length === 0 ? this.retryContext = null : this.retryContext.failedChunks = n.filter((e) => i.includes(e.fileName)), this.config.debug && console.log(`[ScribeSDK] Retry complete: ${a}/${r} succeeded`), {
|
|
2035
2038
|
data: {
|
|
2036
|
-
retried:
|
|
2037
|
-
succeeded:
|
|
2038
|
-
stillFailed:
|
|
2039
|
+
retried: r,
|
|
2040
|
+
succeeded: a,
|
|
2041
|
+
stillFailed: i
|
|
2039
2042
|
},
|
|
2040
2043
|
httpStatus: void 0
|
|
2041
2044
|
};
|
|
@@ -2153,11 +2156,11 @@ var Se = class {
|
|
|
2153
2156
|
resumeRecording() {
|
|
2154
2157
|
this.recordingManager.resume();
|
|
2155
2158
|
}
|
|
2156
|
-
async endRecording() {
|
|
2157
|
-
return this.wrapResult(() => this.recordingManager.stop());
|
|
2159
|
+
async endRecording(e) {
|
|
2160
|
+
return this.wrapResult(() => this.recordingManager.stop(e));
|
|
2158
2161
|
}
|
|
2159
|
-
async retryFailedUploads() {
|
|
2160
|
-
return this.wrapResult(() => this.recordingManager.retryFailedUploads());
|
|
2162
|
+
async retryFailedUploads(e) {
|
|
2163
|
+
return this.wrapResult(() => this.recordingManager.retryFailedUploads(e));
|
|
2161
2164
|
}
|
|
2162
2165
|
hasFailedUploads() {
|
|
2163
2166
|
return this.recordingManager.hasFailedUploads();
|
|
@@ -2193,9 +2196,9 @@ var Se = class {
|
|
|
2193
2196
|
};
|
|
2194
2197
|
});
|
|
2195
2198
|
}
|
|
2196
|
-
async createSession(e) {
|
|
2197
|
-
let
|
|
2198
|
-
return this.wrapResult(() => this.sessionManager.createSession(
|
|
2199
|
+
async createSession(e, t) {
|
|
2200
|
+
let n = this.getEffectiveBaseUrl();
|
|
2201
|
+
return this.wrapResult(() => this.sessionManager.createSession(n, e, t));
|
|
2199
2202
|
}
|
|
2200
2203
|
async endSession(e, t) {
|
|
2201
2204
|
let n = this.getEffectiveBaseUrl();
|
|
@@ -2210,7 +2213,7 @@ var Se = class {
|
|
|
2210
2213
|
}
|
|
2211
2214
|
async getSessionStatus(e, t) {
|
|
2212
2215
|
let n = this.getEffectiveBaseUrl();
|
|
2213
|
-
return t?.poll ? this.wrapResult(() => this.sessionManager.pollForCompletion(n, e, t.poll, t.templateId)) : this.wrapResult(() => this.sessionManager.getSessionStatus(n, e, t?.templateId));
|
|
2216
|
+
return t?.poll ? this.wrapResult(() => this.sessionManager.pollForCompletion(n, e, t.poll, t.templateId, t.version)) : this.wrapResult(() => this.sessionManager.getSessionStatus(n, e, t?.templateId, t?.version));
|
|
2214
2217
|
}
|
|
2215
2218
|
getCurrentSession() {
|
|
2216
2219
|
return this.recordingManager.getActiveSession() ?? this.sessionManager.getCurrentSession();
|