@bagelink/sdk 1.12.67 → 1.12.71
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/index.cjs +8 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +8 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/openAPITools/functionGenerator.ts +8 -1
package/dist/index.cjs
CHANGED
|
@@ -611,7 +611,7 @@ function generateStreamFunction(method, path, formattedPath, allParams, requestB
|
|
|
611
611
|
allParams = "";
|
|
612
612
|
}
|
|
613
613
|
const bodyVar = requestBodyPayload || "{}";
|
|
614
|
-
const baseUrlRef =
|
|
614
|
+
const baseUrlRef = "getStreamBaseURL()";
|
|
615
615
|
const streamTypeName = generateStreamTypeName(path);
|
|
616
616
|
if (eventTypes?.length) {
|
|
617
617
|
streamEventTypes[streamTypeName] = eventTypes;
|
|
@@ -1075,6 +1075,12 @@ type ApiInstance = typeof api & {
|
|
|
1075
1075
|
// Global state
|
|
1076
1076
|
let apiInstance: ApiInstance | null = null
|
|
1077
1077
|
let apiConfig = ref<ApiConfig | null>(null)
|
|
1078
|
+
let _streamBaseURL: string | undefined
|
|
1079
|
+
|
|
1080
|
+
/** Resolve base URL for SSE stream endpoints. Uses streamBaseURL if set, otherwise falls back to axios baseURL. */
|
|
1081
|
+
export function getStreamBaseURL(): string {
|
|
1082
|
+
return _streamBaseURL || axios.defaults.baseURL || ""
|
|
1083
|
+
}
|
|
1078
1084
|
|
|
1079
1085
|
/**
|
|
1080
1086
|
* Create and configure the API instance
|
|
@@ -1089,6 +1095,7 @@ export function createApi(config: ApiConfig = {}): ApiInstance {
|
|
|
1089
1095
|
if (config.baseURL) {
|
|
1090
1096
|
axios.defaults.baseURL = config.baseURL
|
|
1091
1097
|
}
|
|
1098
|
+
_streamBaseURL = config.streamBaseURL
|
|
1092
1099
|
if (config.withCredentials !== undefined) {
|
|
1093
1100
|
axios.defaults.withCredentials = config.withCredentials
|
|
1094
1101
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -655,6 +655,8 @@ type ResponseInterceptor = (response: AxiosResponse) => AxiosResponse | Promise<
|
|
|
655
655
|
*/
|
|
656
656
|
interface ApiConfig {
|
|
657
657
|
baseURL?: string;
|
|
658
|
+
/** Base URL used for SSE stream endpoints (bypasses proxy). Falls back to baseURL if not set. */
|
|
659
|
+
streamBaseURL?: string;
|
|
658
660
|
withCredentials?: boolean;
|
|
659
661
|
onError?: (error: ParsedError, rawError: any) => void;
|
|
660
662
|
auth?: {
|
package/dist/index.d.mts
CHANGED
|
@@ -655,6 +655,8 @@ type ResponseInterceptor = (response: AxiosResponse) => AxiosResponse | Promise<
|
|
|
655
655
|
*/
|
|
656
656
|
interface ApiConfig {
|
|
657
657
|
baseURL?: string;
|
|
658
|
+
/** Base URL used for SSE stream endpoints (bypasses proxy). Falls back to baseURL if not set. */
|
|
659
|
+
streamBaseURL?: string;
|
|
658
660
|
withCredentials?: boolean;
|
|
659
661
|
onError?: (error: ParsedError, rawError: any) => void;
|
|
660
662
|
auth?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -655,6 +655,8 @@ type ResponseInterceptor = (response: AxiosResponse) => AxiosResponse | Promise<
|
|
|
655
655
|
*/
|
|
656
656
|
interface ApiConfig {
|
|
657
657
|
baseURL?: string;
|
|
658
|
+
/** Base URL used for SSE stream endpoints (bypasses proxy). Falls back to baseURL if not set. */
|
|
659
|
+
streamBaseURL?: string;
|
|
658
660
|
withCredentials?: boolean;
|
|
659
661
|
onError?: (error: ParsedError, rawError: any) => void;
|
|
660
662
|
auth?: {
|
package/dist/index.mjs
CHANGED
|
@@ -605,7 +605,7 @@ function generateStreamFunction(method, path, formattedPath, allParams, requestB
|
|
|
605
605
|
allParams = "";
|
|
606
606
|
}
|
|
607
607
|
const bodyVar = requestBodyPayload || "{}";
|
|
608
|
-
const baseUrlRef =
|
|
608
|
+
const baseUrlRef = "getStreamBaseURL()";
|
|
609
609
|
const streamTypeName = generateStreamTypeName(path);
|
|
610
610
|
if (eventTypes?.length) {
|
|
611
611
|
streamEventTypes[streamTypeName] = eventTypes;
|
|
@@ -1069,6 +1069,12 @@ type ApiInstance = typeof api & {
|
|
|
1069
1069
|
// Global state
|
|
1070
1070
|
let apiInstance: ApiInstance | null = null
|
|
1071
1071
|
let apiConfig = ref<ApiConfig | null>(null)
|
|
1072
|
+
let _streamBaseURL: string | undefined
|
|
1073
|
+
|
|
1074
|
+
/** Resolve base URL for SSE stream endpoints. Uses streamBaseURL if set, otherwise falls back to axios baseURL. */
|
|
1075
|
+
export function getStreamBaseURL(): string {
|
|
1076
|
+
return _streamBaseURL || axios.defaults.baseURL || ""
|
|
1077
|
+
}
|
|
1072
1078
|
|
|
1073
1079
|
/**
|
|
1074
1080
|
* Create and configure the API instance
|
|
@@ -1083,6 +1089,7 @@ export function createApi(config: ApiConfig = {}): ApiInstance {
|
|
|
1083
1089
|
if (config.baseURL) {
|
|
1084
1090
|
axios.defaults.baseURL = config.baseURL
|
|
1085
1091
|
}
|
|
1092
|
+
_streamBaseURL = config.streamBaseURL
|
|
1086
1093
|
if (config.withCredentials !== undefined) {
|
|
1087
1094
|
axios.defaults.withCredentials = config.withCredentials
|
|
1088
1095
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -302,6 +302,8 @@ export type ResponseInterceptor = (response: AxiosResponse) => AxiosResponse | P
|
|
|
302
302
|
*/
|
|
303
303
|
export interface ApiConfig {
|
|
304
304
|
baseURL?: string
|
|
305
|
+
/** Base URL used for SSE stream endpoints (bypasses proxy). Falls back to baseURL if not set. */
|
|
306
|
+
streamBaseURL?: string
|
|
305
307
|
withCredentials?: boolean
|
|
306
308
|
onError?: (error: ParsedError, rawError: any) => void
|
|
307
309
|
auth?: {
|
|
@@ -419,7 +419,7 @@ function generateStreamFunction(
|
|
|
419
419
|
// const paramNames = allParams ? allParams.match(/\w+(?=\s*[?:])/g) || [] : []
|
|
420
420
|
|
|
421
421
|
const bodyVar = requestBodyPayload || '{}'
|
|
422
|
-
const baseUrlRef = '
|
|
422
|
+
const baseUrlRef = 'getStreamBaseURL()'
|
|
423
423
|
|
|
424
424
|
// Generate type name for this stream
|
|
425
425
|
const streamTypeName = generateStreamTypeName(path)
|
|
@@ -1094,6 +1094,12 @@ type ApiInstance = typeof api & {
|
|
|
1094
1094
|
// Global state
|
|
1095
1095
|
let apiInstance: ApiInstance | null = null
|
|
1096
1096
|
let apiConfig = ref<ApiConfig | null>(null)
|
|
1097
|
+
let _streamBaseURL: string | undefined
|
|
1098
|
+
|
|
1099
|
+
/** Resolve base URL for SSE stream endpoints. Uses streamBaseURL if set, otherwise falls back to axios baseURL. */
|
|
1100
|
+
export function getStreamBaseURL(): string {
|
|
1101
|
+
return _streamBaseURL || axios.defaults.baseURL || ""
|
|
1102
|
+
}
|
|
1097
1103
|
|
|
1098
1104
|
/**
|
|
1099
1105
|
* Create and configure the API instance
|
|
@@ -1108,6 +1114,7 @@ export function createApi(config: ApiConfig = {}): ApiInstance {
|
|
|
1108
1114
|
if (config.baseURL) {
|
|
1109
1115
|
axios.defaults.baseURL = config.baseURL
|
|
1110
1116
|
}
|
|
1117
|
+
_streamBaseURL = config.streamBaseURL
|
|
1111
1118
|
if (config.withCredentials !== undefined) {
|
|
1112
1119
|
axios.defaults.withCredentials = config.withCredentials
|
|
1113
1120
|
}
|