@jerome-benoit/sap-ai-provider 4.4.18 → 4.5.0
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 +16 -9
- package/dist/{chunk-4CAVT2YC.js → chunk-3VLXFYCM.js} +153 -140
- package/dist/chunk-3VLXFYCM.js.map +1 -0
- package/dist/{chunk-3M6NFVCS.js → chunk-NRLDO6VY.js} +8 -4
- package/dist/chunk-NRLDO6VY.js.map +1 -0
- package/dist/{chunk-BBWFNLML.js → chunk-SC6SVJGO.js} +3 -3
- package/dist/{chunk-O6ASHXPO.js → chunk-T2KXS7WW.js} +445 -321
- package/dist/{chunk-O6ASHXPO.js.map → chunk-T2KXS7WW.js.map} +1 -1
- package/dist/{foundation-models-embedding-model-strategy-XJV5REFR.js → foundation-models-embedding-model-strategy-FO5RWBZ2.js} +4 -4
- package/dist/{foundation-models-language-model-strategy-X6VNJZFG.js → foundation-models-language-model-strategy-COZPNAJ3.js} +11 -6
- package/dist/foundation-models-language-model-strategy-COZPNAJ3.js.map +1 -0
- package/dist/index.cjs +619 -461
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/{orchestration-embedding-model-strategy-3GIX5HAR.js → orchestration-embedding-model-strategy-GEONA32Q.js} +4 -4
- package/dist/{orchestration-language-model-strategy-GYBTFP2F.js → orchestration-language-model-strategy-PZBP7G5O.js} +18 -5
- package/dist/orchestration-language-model-strategy-PZBP7G5O.js.map +1 -0
- package/package.json +15 -15
- package/dist/chunk-3M6NFVCS.js.map +0 -1
- package/dist/chunk-4CAVT2YC.js.map +0 -1
- package/dist/foundation-models-language-model-strategy-X6VNJZFG.js.map +0 -1
- package/dist/orchestration-language-model-strategy-GYBTFP2F.js.map +0 -1
- /package/dist/{chunk-BBWFNLML.js.map → chunk-SC6SVJGO.js.map} +0 -0
- /package/dist/{foundation-models-embedding-model-strategy-XJV5REFR.js.map → foundation-models-embedding-model-strategy-FO5RWBZ2.js.map} +0 -0
- /package/dist/{orchestration-embedding-model-strategy-3GIX5HAR.js.map → orchestration-embedding-model-strategy-GEONA32Q.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -26573,12 +26573,25 @@ var require_axios = __commonJS({
|
|
|
26573
26573
|
};
|
|
26574
26574
|
var isDate = kindOfTest("Date");
|
|
26575
26575
|
var isFile = kindOfTest("File");
|
|
26576
|
+
var isReactNativeBlob = (value) => {
|
|
26577
|
+
return !!(value && typeof value.uri !== "undefined");
|
|
26578
|
+
};
|
|
26579
|
+
var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
|
|
26576
26580
|
var isBlob = kindOfTest("Blob");
|
|
26577
26581
|
var isFileList = kindOfTest("FileList");
|
|
26578
26582
|
var isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
26583
|
+
function getGlobal() {
|
|
26584
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
26585
|
+
if (typeof self !== "undefined") return self;
|
|
26586
|
+
if (typeof window !== "undefined") return window;
|
|
26587
|
+
if (typeof global !== "undefined") return global;
|
|
26588
|
+
return {};
|
|
26589
|
+
}
|
|
26590
|
+
var G = getGlobal();
|
|
26591
|
+
var FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
|
|
26579
26592
|
var isFormData = (thing) => {
|
|
26580
26593
|
let kind;
|
|
26581
|
-
return thing && (
|
|
26594
|
+
return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
26582
26595
|
kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
|
|
26583
26596
|
};
|
|
26584
26597
|
var isURLSearchParams = kindOfTest("URLSearchParams");
|
|
@@ -26588,7 +26601,9 @@ var require_axios = __commonJS({
|
|
|
26588
26601
|
"Response",
|
|
26589
26602
|
"Headers"
|
|
26590
26603
|
].map(kindOfTest);
|
|
26591
|
-
var trim2 = (str) =>
|
|
26604
|
+
var trim2 = (str) => {
|
|
26605
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
26606
|
+
};
|
|
26592
26607
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
26593
26608
|
if (obj === null || typeof obj === "undefined") {
|
|
26594
26609
|
return;
|
|
@@ -26690,10 +26705,7 @@ var require_axios = __commonJS({
|
|
|
26690
26705
|
return content;
|
|
26691
26706
|
};
|
|
26692
26707
|
var inherits = (constructor, superConstructor, props, descriptors) => {
|
|
26693
|
-
constructor.prototype = Object.create(
|
|
26694
|
-
superConstructor.prototype,
|
|
26695
|
-
descriptors
|
|
26696
|
-
);
|
|
26708
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
26697
26709
|
Object.defineProperty(constructor.prototype, "constructor", {
|
|
26698
26710
|
value: constructor,
|
|
26699
26711
|
writable: true,
|
|
@@ -26892,6 +26904,8 @@ var require_axios = __commonJS({
|
|
|
26892
26904
|
isUndefined,
|
|
26893
26905
|
isDate,
|
|
26894
26906
|
isFile,
|
|
26907
|
+
isReactNativeBlob,
|
|
26908
|
+
isReactNative,
|
|
26895
26909
|
isBlob,
|
|
26896
26910
|
isRegExp,
|
|
26897
26911
|
isFunction: isFunction$1,
|
|
@@ -26938,6 +26952,9 @@ var require_axios = __commonJS({
|
|
|
26938
26952
|
const axiosError = new _AxiosError(error.message, code || error.code, config, request, response);
|
|
26939
26953
|
axiosError.cause = error;
|
|
26940
26954
|
axiosError.name = error.name;
|
|
26955
|
+
if (error.status != null && axiosError.status == null) {
|
|
26956
|
+
axiosError.status = error.status;
|
|
26957
|
+
}
|
|
26941
26958
|
customProps && Object.assign(axiosError, customProps);
|
|
26942
26959
|
return axiosError;
|
|
26943
26960
|
}
|
|
@@ -26954,6 +26971,12 @@ var require_axios = __commonJS({
|
|
|
26954
26971
|
*/
|
|
26955
26972
|
constructor(message, code, config, request, response) {
|
|
26956
26973
|
super(message);
|
|
26974
|
+
Object.defineProperty(this, "message", {
|
|
26975
|
+
value: message,
|
|
26976
|
+
enumerable: true,
|
|
26977
|
+
writable: true,
|
|
26978
|
+
configurable: true
|
|
26979
|
+
});
|
|
26957
26980
|
this.name = "AxiosError";
|
|
26958
26981
|
this.isAxiosError = true;
|
|
26959
26982
|
code && (this.code = code);
|
|
@@ -27021,13 +27044,18 @@ var require_axios = __commonJS({
|
|
|
27021
27044
|
throw new TypeError("target must be an object");
|
|
27022
27045
|
}
|
|
27023
27046
|
formData = formData || new (FormData__default["default"] || FormData)();
|
|
27024
|
-
options = utils$1.toFlatObject(
|
|
27025
|
-
|
|
27026
|
-
|
|
27027
|
-
|
|
27028
|
-
|
|
27029
|
-
|
|
27030
|
-
|
|
27047
|
+
options = utils$1.toFlatObject(
|
|
27048
|
+
options,
|
|
27049
|
+
{
|
|
27050
|
+
metaTokens: true,
|
|
27051
|
+
dots: false,
|
|
27052
|
+
indexes: false
|
|
27053
|
+
},
|
|
27054
|
+
false,
|
|
27055
|
+
function defined(option, source) {
|
|
27056
|
+
return !utils$1.isUndefined(source[option]);
|
|
27057
|
+
}
|
|
27058
|
+
);
|
|
27031
27059
|
const metaTokens = options.metaTokens;
|
|
27032
27060
|
const visitor = options.visitor || defaultVisitor;
|
|
27033
27061
|
const dots = options.dots;
|
|
@@ -27055,6 +27083,10 @@ var require_axios = __commonJS({
|
|
|
27055
27083
|
}
|
|
27056
27084
|
function defaultVisitor(value, key, path) {
|
|
27057
27085
|
let arr = value;
|
|
27086
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
27087
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
27088
|
+
return false;
|
|
27089
|
+
}
|
|
27058
27090
|
if (value && !path && typeof value === "object") {
|
|
27059
27091
|
if (utils$1.endsWith(key, "{}")) {
|
|
27060
27092
|
key = metaTokens ? key : key.slice(0, -2);
|
|
@@ -27090,13 +27122,7 @@ var require_axios = __commonJS({
|
|
|
27090
27122
|
}
|
|
27091
27123
|
stack.push(value);
|
|
27092
27124
|
utils$1.forEach(value, function each(el, key) {
|
|
27093
|
-
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
27094
|
-
formData,
|
|
27095
|
-
el,
|
|
27096
|
-
utils$1.isString(key) ? key.trim() : key,
|
|
27097
|
-
path,
|
|
27098
|
-
exposedHelpers
|
|
27099
|
-
);
|
|
27125
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
27100
27126
|
if (result === true) {
|
|
27101
27127
|
build(el, path ? path.concat(key) : [key]);
|
|
27102
27128
|
}
|
|
@@ -27362,70 +27388,74 @@ var require_axios = __commonJS({
|
|
|
27362
27388
|
var defaults = {
|
|
27363
27389
|
transitional: transitionalDefaults,
|
|
27364
27390
|
adapter: ["xhr", "http", "fetch"],
|
|
27365
|
-
transformRequest: [
|
|
27366
|
-
|
|
27367
|
-
|
|
27368
|
-
|
|
27369
|
-
|
|
27370
|
-
|
|
27371
|
-
|
|
27372
|
-
|
|
27373
|
-
|
|
27374
|
-
|
|
27375
|
-
|
|
27376
|
-
|
|
27377
|
-
|
|
27378
|
-
|
|
27379
|
-
|
|
27380
|
-
|
|
27381
|
-
|
|
27382
|
-
|
|
27383
|
-
|
|
27384
|
-
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27388
|
-
if (
|
|
27389
|
-
|
|
27391
|
+
transformRequest: [
|
|
27392
|
+
function transformRequest(data, headers) {
|
|
27393
|
+
const contentType = headers.getContentType() || "";
|
|
27394
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
27395
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
27396
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
27397
|
+
data = new FormData(data);
|
|
27398
|
+
}
|
|
27399
|
+
const isFormData2 = utils$1.isFormData(data);
|
|
27400
|
+
if (isFormData2) {
|
|
27401
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
27402
|
+
}
|
|
27403
|
+
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
|
|
27404
|
+
return data;
|
|
27405
|
+
}
|
|
27406
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
27407
|
+
return data.buffer;
|
|
27408
|
+
}
|
|
27409
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
27410
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
27411
|
+
return data.toString();
|
|
27412
|
+
}
|
|
27413
|
+
let isFileList2;
|
|
27414
|
+
if (isObjectPayload) {
|
|
27415
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
27416
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
27417
|
+
}
|
|
27418
|
+
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
27419
|
+
const _FormData = this.env && this.env.FormData;
|
|
27420
|
+
return toFormData(
|
|
27421
|
+
isFileList2 ? { "files[]": data } : data,
|
|
27422
|
+
_FormData && new _FormData(),
|
|
27423
|
+
this.formSerializer
|
|
27424
|
+
);
|
|
27425
|
+
}
|
|
27390
27426
|
}
|
|
27391
|
-
if (
|
|
27392
|
-
|
|
27393
|
-
return
|
|
27394
|
-
isFileList2 ? { "files[]": data } : data,
|
|
27395
|
-
_FormData && new _FormData(),
|
|
27396
|
-
this.formSerializer
|
|
27397
|
-
);
|
|
27427
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
27428
|
+
headers.setContentType("application/json", false);
|
|
27429
|
+
return stringifySafely(data);
|
|
27398
27430
|
}
|
|
27399
|
-
}
|
|
27400
|
-
if (isObjectPayload || hasJSONContentType) {
|
|
27401
|
-
headers.setContentType("application/json", false);
|
|
27402
|
-
return stringifySafely(data);
|
|
27403
|
-
}
|
|
27404
|
-
return data;
|
|
27405
|
-
}],
|
|
27406
|
-
transformResponse: [function transformResponse(data) {
|
|
27407
|
-
const transitional = this.transitional || defaults.transitional;
|
|
27408
|
-
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
27409
|
-
const JSONRequested = this.responseType === "json";
|
|
27410
|
-
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
27411
27431
|
return data;
|
|
27412
27432
|
}
|
|
27413
|
-
|
|
27414
|
-
|
|
27415
|
-
|
|
27416
|
-
|
|
27417
|
-
|
|
27418
|
-
|
|
27419
|
-
|
|
27420
|
-
|
|
27421
|
-
|
|
27433
|
+
],
|
|
27434
|
+
transformResponse: [
|
|
27435
|
+
function transformResponse(data) {
|
|
27436
|
+
const transitional = this.transitional || defaults.transitional;
|
|
27437
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
27438
|
+
const JSONRequested = this.responseType === "json";
|
|
27439
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
27440
|
+
return data;
|
|
27441
|
+
}
|
|
27442
|
+
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
27443
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
27444
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
27445
|
+
try {
|
|
27446
|
+
return JSON.parse(data, this.parseReviver);
|
|
27447
|
+
} catch (e) {
|
|
27448
|
+
if (strictJSONParsing) {
|
|
27449
|
+
if (e.name === "SyntaxError") {
|
|
27450
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
27451
|
+
}
|
|
27452
|
+
throw e;
|
|
27422
27453
|
}
|
|
27423
|
-
throw e;
|
|
27424
27454
|
}
|
|
27425
27455
|
}
|
|
27456
|
+
return data;
|
|
27426
27457
|
}
|
|
27427
|
-
|
|
27428
|
-
}],
|
|
27458
|
+
],
|
|
27429
27459
|
/**
|
|
27430
27460
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
27431
27461
|
* timeout is not created.
|
|
@@ -27444,7 +27474,7 @@ var require_axios = __commonJS({
|
|
|
27444
27474
|
},
|
|
27445
27475
|
headers: {
|
|
27446
27476
|
common: {
|
|
27447
|
-
|
|
27477
|
+
Accept: "application/json, text/plain, */*",
|
|
27448
27478
|
"Content-Type": void 0
|
|
27449
27479
|
}
|
|
27450
27480
|
}
|
|
@@ -27711,7 +27741,14 @@ var require_axios = __commonJS({
|
|
|
27711
27741
|
return this;
|
|
27712
27742
|
}
|
|
27713
27743
|
};
|
|
27714
|
-
AxiosHeaders.accessor([
|
|
27744
|
+
AxiosHeaders.accessor([
|
|
27745
|
+
"Content-Type",
|
|
27746
|
+
"Content-Length",
|
|
27747
|
+
"Accept",
|
|
27748
|
+
"Accept-Encoding",
|
|
27749
|
+
"User-Agent",
|
|
27750
|
+
"Authorization"
|
|
27751
|
+
]);
|
|
27715
27752
|
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
27716
27753
|
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
27717
27754
|
return {
|
|
@@ -27759,13 +27796,15 @@ var require_axios = __commonJS({
|
|
|
27759
27796
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
27760
27797
|
resolve(response);
|
|
27761
27798
|
} else {
|
|
27762
|
-
reject(
|
|
27763
|
-
|
|
27764
|
-
|
|
27765
|
-
|
|
27766
|
-
|
|
27767
|
-
|
|
27768
|
-
|
|
27799
|
+
reject(
|
|
27800
|
+
new AxiosError$1(
|
|
27801
|
+
"Request failed with status code " + response.status,
|
|
27802
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
27803
|
+
response.config,
|
|
27804
|
+
response.request,
|
|
27805
|
+
response
|
|
27806
|
+
)
|
|
27807
|
+
);
|
|
27769
27808
|
}
|
|
27770
27809
|
}
|
|
27771
27810
|
function isAbsoluteURL(url2) {
|
|
@@ -27784,7 +27823,7 @@ var require_axios = __commonJS({
|
|
|
27784
27823
|
}
|
|
27785
27824
|
return requestedURL;
|
|
27786
27825
|
}
|
|
27787
|
-
var VERSION2 = "1.13.
|
|
27826
|
+
var VERSION2 = "1.13.6";
|
|
27788
27827
|
function parseProtocol(url2) {
|
|
27789
27828
|
const match2 = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
|
|
27790
27829
|
return match2 && match2[1] || "";
|
|
@@ -27819,16 +27858,21 @@ var require_axios = __commonJS({
|
|
|
27819
27858
|
var kInternals = /* @__PURE__ */ Symbol("internals");
|
|
27820
27859
|
var AxiosTransformStream = class extends stream__default["default"].Transform {
|
|
27821
27860
|
constructor(options) {
|
|
27822
|
-
options = utils$1.toFlatObject(
|
|
27823
|
-
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
|
|
27827
|
-
|
|
27828
|
-
|
|
27829
|
-
|
|
27830
|
-
|
|
27831
|
-
|
|
27861
|
+
options = utils$1.toFlatObject(
|
|
27862
|
+
options,
|
|
27863
|
+
{
|
|
27864
|
+
maxRate: 0,
|
|
27865
|
+
chunkSize: 64 * 1024,
|
|
27866
|
+
minChunkSize: 100,
|
|
27867
|
+
timeWindow: 500,
|
|
27868
|
+
ticksRate: 2,
|
|
27869
|
+
samplesCount: 15
|
|
27870
|
+
},
|
|
27871
|
+
null,
|
|
27872
|
+
(prop, source) => {
|
|
27873
|
+
return !utils$1.isUndefined(source[prop]);
|
|
27874
|
+
}
|
|
27875
|
+
);
|
|
27832
27876
|
super({
|
|
27833
27877
|
readableHighWaterMark: options.chunkSize
|
|
27834
27878
|
});
|
|
@@ -27911,9 +27955,12 @@ var require_axios = __commonJS({
|
|
|
27911
27955
|
chunkRemainder = _chunk.subarray(maxChunkSize);
|
|
27912
27956
|
_chunk = _chunk.subarray(0, maxChunkSize);
|
|
27913
27957
|
}
|
|
27914
|
-
pushChunk(
|
|
27915
|
-
|
|
27916
|
-
|
|
27958
|
+
pushChunk(
|
|
27959
|
+
_chunk,
|
|
27960
|
+
chunkRemainder ? () => {
|
|
27961
|
+
process.nextTick(_callback, null, chunkRemainder);
|
|
27962
|
+
} : _callback
|
|
27963
|
+
);
|
|
27917
27964
|
};
|
|
27918
27965
|
transformChunk(chunk, function transformNextChunk(err, _chunk) {
|
|
27919
27966
|
if (err) {
|
|
@@ -27973,11 +28020,14 @@ var require_axios = __commonJS({
|
|
|
27973
28020
|
yield CRLF_BYTES;
|
|
27974
28021
|
}
|
|
27975
28022
|
static escapeName(name) {
|
|
27976
|
-
return String(name).replace(
|
|
27977
|
-
|
|
27978
|
-
|
|
27979
|
-
|
|
27980
|
-
|
|
28023
|
+
return String(name).replace(
|
|
28024
|
+
/[\r\n"]/g,
|
|
28025
|
+
(match2) => ({
|
|
28026
|
+
"\r": "%0D",
|
|
28027
|
+
"\n": "%0A",
|
|
28028
|
+
'"': "%22"
|
|
28029
|
+
})[match2]
|
|
28030
|
+
);
|
|
27981
28031
|
}
|
|
27982
28032
|
};
|
|
27983
28033
|
var formDataToStream = (form, headersHandler, options) => {
|
|
@@ -28009,13 +28059,15 @@ var require_axios = __commonJS({
|
|
|
28009
28059
|
computedHeaders["Content-Length"] = contentLength;
|
|
28010
28060
|
}
|
|
28011
28061
|
headersHandler && headersHandler(computedHeaders);
|
|
28012
|
-
return stream.Readable.from(
|
|
28013
|
-
|
|
28014
|
-
|
|
28015
|
-
|
|
28016
|
-
|
|
28017
|
-
|
|
28018
|
-
|
|
28062
|
+
return stream.Readable.from(
|
|
28063
|
+
(async function* () {
|
|
28064
|
+
for (const part of parts) {
|
|
28065
|
+
yield boundaryBytes;
|
|
28066
|
+
yield* part.encode();
|
|
28067
|
+
}
|
|
28068
|
+
yield footerBytes;
|
|
28069
|
+
})()
|
|
28070
|
+
);
|
|
28019
28071
|
};
|
|
28020
28072
|
var formDataToStream$1 = formDataToStream;
|
|
28021
28073
|
var ZlibHeaderTransformStream = class extends stream__default["default"].Transform {
|
|
@@ -28141,11 +28193,14 @@ var require_axios = __commonJS({
|
|
|
28141
28193
|
};
|
|
28142
28194
|
var progressEventDecorator = (total, throttled) => {
|
|
28143
28195
|
const lengthComputable = total != null;
|
|
28144
|
-
return [
|
|
28145
|
-
|
|
28146
|
-
|
|
28147
|
-
|
|
28148
|
-
|
|
28196
|
+
return [
|
|
28197
|
+
(loaded) => throttled[0]({
|
|
28198
|
+
lengthComputable,
|
|
28199
|
+
total,
|
|
28200
|
+
loaded
|
|
28201
|
+
}),
|
|
28202
|
+
throttled[1]
|
|
28203
|
+
];
|
|
28149
28204
|
};
|
|
28150
28205
|
var asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
28151
28206
|
function estimateDataURLDecodedBytes(url2) {
|
|
@@ -28220,9 +28275,12 @@ var require_axios = __commonJS({
|
|
|
28220
28275
|
this.sessions = /* @__PURE__ */ Object.create(null);
|
|
28221
28276
|
}
|
|
28222
28277
|
getSession(authority, options) {
|
|
28223
|
-
options = Object.assign(
|
|
28224
|
-
|
|
28225
|
-
|
|
28278
|
+
options = Object.assign(
|
|
28279
|
+
{
|
|
28280
|
+
sessionTimeout: 1e3
|
|
28281
|
+
},
|
|
28282
|
+
options
|
|
28283
|
+
);
|
|
28226
28284
|
let authoritySessions = this.sessions[authority];
|
|
28227
28285
|
if (authoritySessions) {
|
|
28228
28286
|
let len = authoritySessions.length;
|
|
@@ -28276,10 +28334,7 @@ var require_axios = __commonJS({
|
|
|
28276
28334
|
};
|
|
28277
28335
|
}
|
|
28278
28336
|
session.once("close", removeSession);
|
|
28279
|
-
let entry = [
|
|
28280
|
-
session,
|
|
28281
|
-
options
|
|
28282
|
-
];
|
|
28337
|
+
let entry = [session, options];
|
|
28283
28338
|
authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
|
|
28284
28339
|
return session;
|
|
28285
28340
|
}
|
|
@@ -28365,12 +28420,7 @@ var require_axios = __commonJS({
|
|
|
28365
28420
|
const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
|
|
28366
28421
|
const { http2Options, headers } = options;
|
|
28367
28422
|
const session = http2Sessions.getSession(authority, http2Options);
|
|
28368
|
-
const {
|
|
28369
|
-
HTTP2_HEADER_SCHEME,
|
|
28370
|
-
HTTP2_HEADER_METHOD,
|
|
28371
|
-
HTTP2_HEADER_PATH,
|
|
28372
|
-
HTTP2_HEADER_STATUS
|
|
28373
|
-
} = http2__default["default"].constants;
|
|
28423
|
+
const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } = http2__default["default"].constants;
|
|
28374
28424
|
const http2Headers = {
|
|
28375
28425
|
[HTTP2_HEADER_SCHEME]: options.protocol.replace(":", ""),
|
|
28376
28426
|
[HTTP2_HEADER_METHOD]: options.method,
|
|
@@ -28423,7 +28473,10 @@ var require_axios = __commonJS({
|
|
|
28423
28473
|
const abortEmitter = new events.EventEmitter();
|
|
28424
28474
|
function abort(reason) {
|
|
28425
28475
|
try {
|
|
28426
|
-
abortEmitter.emit(
|
|
28476
|
+
abortEmitter.emit(
|
|
28477
|
+
"abort",
|
|
28478
|
+
!reason || reason.type ? new CanceledError$1(null, config, req) : reason
|
|
28479
|
+
);
|
|
28427
28480
|
} catch (err) {
|
|
28428
28481
|
console.warn("emit error", err);
|
|
28429
28482
|
}
|
|
@@ -28469,11 +28522,13 @@ var require_axios = __commonJS({
|
|
|
28469
28522
|
const dataUrl = String(config.url || fullPath || "");
|
|
28470
28523
|
const estimated = estimateDataURLDecodedBytes(dataUrl);
|
|
28471
28524
|
if (estimated > config.maxContentLength) {
|
|
28472
|
-
return reject(
|
|
28473
|
-
|
|
28474
|
-
|
|
28475
|
-
|
|
28476
|
-
|
|
28525
|
+
return reject(
|
|
28526
|
+
new AxiosError$1(
|
|
28527
|
+
"maxContentLength size of " + config.maxContentLength + " exceeded",
|
|
28528
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
28529
|
+
config
|
|
28530
|
+
)
|
|
28531
|
+
);
|
|
28477
28532
|
}
|
|
28478
28533
|
}
|
|
28479
28534
|
let convertedData;
|
|
@@ -28509,11 +28564,9 @@ var require_axios = __commonJS({
|
|
|
28509
28564
|
});
|
|
28510
28565
|
}
|
|
28511
28566
|
if (supportedProtocols.indexOf(protocol) === -1) {
|
|
28512
|
-
return reject(
|
|
28513
|
-
"Unsupported protocol " + protocol,
|
|
28514
|
-
|
|
28515
|
-
config
|
|
28516
|
-
));
|
|
28567
|
+
return reject(
|
|
28568
|
+
new AxiosError$1("Unsupported protocol " + protocol, AxiosError$1.ERR_BAD_REQUEST, config)
|
|
28569
|
+
);
|
|
28517
28570
|
}
|
|
28518
28571
|
const headers = AxiosHeaders$1.from(config.headers).normalize();
|
|
28519
28572
|
headers.set("User-Agent", "axios/" + VERSION2, false);
|
|
@@ -28523,12 +28576,16 @@ var require_axios = __commonJS({
|
|
|
28523
28576
|
let maxDownloadRate = void 0;
|
|
28524
28577
|
if (utils$1.isSpecCompliantForm(data)) {
|
|
28525
28578
|
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
|
28526
|
-
data = formDataToStream$1(
|
|
28527
|
-
|
|
28528
|
-
|
|
28529
|
-
|
|
28530
|
-
|
|
28531
|
-
|
|
28579
|
+
data = formDataToStream$1(
|
|
28580
|
+
data,
|
|
28581
|
+
(formHeaders) => {
|
|
28582
|
+
headers.set(formHeaders);
|
|
28583
|
+
},
|
|
28584
|
+
{
|
|
28585
|
+
tag: `axios-${VERSION2}-boundary`,
|
|
28586
|
+
boundary: userBoundary && userBoundary[1] || void 0
|
|
28587
|
+
}
|
|
28588
|
+
);
|
|
28532
28589
|
} else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
|
|
28533
28590
|
headers.set(data.getHeaders());
|
|
28534
28591
|
if (!headers.hasContentLength()) {
|
|
@@ -28549,19 +28606,23 @@ var require_axios = __commonJS({
|
|
|
28549
28606
|
} else if (utils$1.isString(data)) {
|
|
28550
28607
|
data = Buffer.from(data, "utf-8");
|
|
28551
28608
|
} else {
|
|
28552
|
-
return reject(
|
|
28553
|
-
|
|
28554
|
-
|
|
28555
|
-
|
|
28556
|
-
|
|
28609
|
+
return reject(
|
|
28610
|
+
new AxiosError$1(
|
|
28611
|
+
"Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",
|
|
28612
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
28613
|
+
config
|
|
28614
|
+
)
|
|
28615
|
+
);
|
|
28557
28616
|
}
|
|
28558
28617
|
headers.setContentLength(data.length, false);
|
|
28559
28618
|
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
|
28560
|
-
return reject(
|
|
28561
|
-
|
|
28562
|
-
|
|
28563
|
-
|
|
28564
|
-
|
|
28619
|
+
return reject(
|
|
28620
|
+
new AxiosError$1(
|
|
28621
|
+
"Request body larger than maxBodyLength limit",
|
|
28622
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
28623
|
+
config
|
|
28624
|
+
)
|
|
28625
|
+
);
|
|
28565
28626
|
}
|
|
28566
28627
|
}
|
|
28567
28628
|
const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
|
|
@@ -28575,16 +28636,25 @@ var require_axios = __commonJS({
|
|
|
28575
28636
|
if (!utils$1.isStream(data)) {
|
|
28576
28637
|
data = stream__default["default"].Readable.from(data, { objectMode: false });
|
|
28577
28638
|
}
|
|
28578
|
-
data = stream__default["default"].pipeline(
|
|
28579
|
-
|
|
28580
|
-
|
|
28581
|
-
|
|
28582
|
-
|
|
28583
|
-
|
|
28584
|
-
|
|
28585
|
-
|
|
28639
|
+
data = stream__default["default"].pipeline(
|
|
28640
|
+
[
|
|
28641
|
+
data,
|
|
28642
|
+
new AxiosTransformStream$1({
|
|
28643
|
+
maxRate: utils$1.toFiniteNumber(maxUploadRate)
|
|
28644
|
+
})
|
|
28645
|
+
],
|
|
28646
|
+
utils$1.noop
|
|
28647
|
+
);
|
|
28648
|
+
onUploadProgress && data.on(
|
|
28649
|
+
"progress",
|
|
28650
|
+
flushOnFinish(
|
|
28651
|
+
data,
|
|
28652
|
+
progressEventDecorator(
|
|
28653
|
+
contentLength,
|
|
28654
|
+
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
|
|
28655
|
+
)
|
|
28586
28656
|
)
|
|
28587
|
-
)
|
|
28657
|
+
);
|
|
28588
28658
|
}
|
|
28589
28659
|
let auth = void 0;
|
|
28590
28660
|
if (config.auth) {
|
|
@@ -28635,7 +28705,11 @@ var require_axios = __commonJS({
|
|
|
28635
28705
|
} else {
|
|
28636
28706
|
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
|
28637
28707
|
options.port = parsed.port;
|
|
28638
|
-
setProxy(
|
|
28708
|
+
setProxy(
|
|
28709
|
+
options,
|
|
28710
|
+
config.proxy,
|
|
28711
|
+
protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path
|
|
28712
|
+
);
|
|
28639
28713
|
}
|
|
28640
28714
|
let transport;
|
|
28641
28715
|
const isHttpsRequest = isHttps.test(options.protocol);
|
|
@@ -28673,13 +28747,16 @@ var require_axios = __commonJS({
|
|
|
28673
28747
|
const transformStream = new AxiosTransformStream$1({
|
|
28674
28748
|
maxRate: utils$1.toFiniteNumber(maxDownloadRate)
|
|
28675
28749
|
});
|
|
28676
|
-
onDownloadProgress && transformStream.on(
|
|
28677
|
-
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
|
|
28750
|
+
onDownloadProgress && transformStream.on(
|
|
28751
|
+
"progress",
|
|
28752
|
+
flushOnFinish(
|
|
28753
|
+
transformStream,
|
|
28754
|
+
progressEventDecorator(
|
|
28755
|
+
responseLength,
|
|
28756
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
|
|
28757
|
+
)
|
|
28681
28758
|
)
|
|
28682
|
-
)
|
|
28759
|
+
);
|
|
28683
28760
|
streams.push(transformStream);
|
|
28684
28761
|
}
|
|
28685
28762
|
let responseStream = res;
|
|
@@ -28729,12 +28806,14 @@ var require_axios = __commonJS({
|
|
|
28729
28806
|
if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
|
|
28730
28807
|
rejected = true;
|
|
28731
28808
|
responseStream.destroy();
|
|
28732
|
-
abort(
|
|
28733
|
-
|
|
28734
|
-
|
|
28735
|
-
|
|
28736
|
-
|
|
28737
|
-
|
|
28809
|
+
abort(
|
|
28810
|
+
new AxiosError$1(
|
|
28811
|
+
"maxContentLength size of " + config.maxContentLength + " exceeded",
|
|
28812
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
28813
|
+
config,
|
|
28814
|
+
lastRequest
|
|
28815
|
+
)
|
|
28816
|
+
);
|
|
28738
28817
|
}
|
|
28739
28818
|
});
|
|
28740
28819
|
responseStream.on("aborted", function handlerStreamAborted() {
|
|
@@ -28793,12 +28872,14 @@ var require_axios = __commonJS({
|
|
|
28793
28872
|
if (config.timeout) {
|
|
28794
28873
|
const timeout = parseInt(config.timeout, 10);
|
|
28795
28874
|
if (Number.isNaN(timeout)) {
|
|
28796
|
-
abort(
|
|
28797
|
-
|
|
28798
|
-
|
|
28799
|
-
|
|
28800
|
-
|
|
28801
|
-
|
|
28875
|
+
abort(
|
|
28876
|
+
new AxiosError$1(
|
|
28877
|
+
"error trying to parse `config.timeout` to int",
|
|
28878
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE,
|
|
28879
|
+
config,
|
|
28880
|
+
req
|
|
28881
|
+
)
|
|
28882
|
+
);
|
|
28802
28883
|
return;
|
|
28803
28884
|
}
|
|
28804
28885
|
req.setTimeout(timeout, function handleRequestTimeout() {
|
|
@@ -28808,12 +28889,14 @@ var require_axios = __commonJS({
|
|
|
28808
28889
|
if (config.timeoutErrorMessage) {
|
|
28809
28890
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
28810
28891
|
}
|
|
28811
|
-
abort(
|
|
28812
|
-
|
|
28813
|
-
|
|
28814
|
-
|
|
28815
|
-
|
|
28816
|
-
|
|
28892
|
+
abort(
|
|
28893
|
+
new AxiosError$1(
|
|
28894
|
+
timeoutErrorMessage,
|
|
28895
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
28896
|
+
config,
|
|
28897
|
+
req
|
|
28898
|
+
)
|
|
28899
|
+
);
|
|
28817
28900
|
});
|
|
28818
28901
|
} else {
|
|
28819
28902
|
req.setTimeout(0);
|
|
@@ -28962,27 +29045,29 @@ var require_axios = __commonJS({
|
|
|
28962
29045
|
validateStatus: mergeDirectKeys,
|
|
28963
29046
|
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
28964
29047
|
};
|
|
28965
|
-
utils$1.forEach(
|
|
28966
|
-
|
|
28967
|
-
|
|
28968
|
-
|
|
28969
|
-
|
|
28970
|
-
|
|
28971
|
-
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
28972
|
-
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
28973
|
-
}
|
|
28974
|
-
);
|
|
29048
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
29049
|
+
if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
|
|
29050
|
+
const merge2 = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
29051
|
+
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
29052
|
+
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
29053
|
+
});
|
|
28975
29054
|
return config;
|
|
28976
29055
|
}
|
|
28977
29056
|
var resolveConfig = (config) => {
|
|
28978
29057
|
const newConfig = mergeConfig({}, config);
|
|
28979
29058
|
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
28980
29059
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
28981
|
-
newConfig.url = buildURL(
|
|
29060
|
+
newConfig.url = buildURL(
|
|
29061
|
+
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
29062
|
+
config.params,
|
|
29063
|
+
config.paramsSerializer
|
|
29064
|
+
);
|
|
28982
29065
|
if (auth) {
|
|
28983
29066
|
headers.set(
|
|
28984
29067
|
"Authorization",
|
|
28985
|
-
"Basic " + btoa(
|
|
29068
|
+
"Basic " + btoa(
|
|
29069
|
+
(auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")
|
|
29070
|
+
)
|
|
28986
29071
|
);
|
|
28987
29072
|
}
|
|
28988
29073
|
if (utils$1.isFormData(data)) {
|
|
@@ -29044,13 +29129,17 @@ var require_axios = __commonJS({
|
|
|
29044
29129
|
config,
|
|
29045
29130
|
request
|
|
29046
29131
|
};
|
|
29047
|
-
settle(
|
|
29048
|
-
|
|
29049
|
-
|
|
29050
|
-
|
|
29051
|
-
|
|
29052
|
-
|
|
29053
|
-
|
|
29132
|
+
settle(
|
|
29133
|
+
function _resolve(value) {
|
|
29134
|
+
resolve(value);
|
|
29135
|
+
done();
|
|
29136
|
+
},
|
|
29137
|
+
function _reject(err) {
|
|
29138
|
+
reject(err);
|
|
29139
|
+
done();
|
|
29140
|
+
},
|
|
29141
|
+
response
|
|
29142
|
+
);
|
|
29054
29143
|
request = null;
|
|
29055
29144
|
}
|
|
29056
29145
|
if ("onloadend" in request) {
|
|
@@ -29086,12 +29175,14 @@ var require_axios = __commonJS({
|
|
|
29086
29175
|
if (_config.timeoutErrorMessage) {
|
|
29087
29176
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
29088
29177
|
}
|
|
29089
|
-
reject(
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29178
|
+
reject(
|
|
29179
|
+
new AxiosError$1(
|
|
29180
|
+
timeoutErrorMessage,
|
|
29181
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
29182
|
+
config,
|
|
29183
|
+
request
|
|
29184
|
+
)
|
|
29185
|
+
);
|
|
29095
29186
|
request = null;
|
|
29096
29187
|
};
|
|
29097
29188
|
requestData === void 0 && requestHeaders.setContentType(null);
|
|
@@ -29131,7 +29222,13 @@ var require_axios = __commonJS({
|
|
|
29131
29222
|
}
|
|
29132
29223
|
const protocol = parseProtocol(_config.url);
|
|
29133
29224
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
29134
|
-
reject(
|
|
29225
|
+
reject(
|
|
29226
|
+
new AxiosError$1(
|
|
29227
|
+
"Unsupported protocol " + protocol + ":",
|
|
29228
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
29229
|
+
config
|
|
29230
|
+
)
|
|
29231
|
+
);
|
|
29135
29232
|
return;
|
|
29136
29233
|
}
|
|
29137
29234
|
request.send(requestData || null);
|
|
@@ -29147,7 +29244,9 @@ var require_axios = __commonJS({
|
|
|
29147
29244
|
aborted = true;
|
|
29148
29245
|
unsubscribe();
|
|
29149
29246
|
const err = reason instanceof Error ? reason : this.reason;
|
|
29150
|
-
controller.abort(
|
|
29247
|
+
controller.abort(
|
|
29248
|
+
err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err)
|
|
29249
|
+
);
|
|
29151
29250
|
}
|
|
29152
29251
|
};
|
|
29153
29252
|
let timer = timeout && setTimeout(() => {
|
|
@@ -29218,33 +29317,36 @@ var require_axios = __commonJS({
|
|
|
29218
29317
|
onFinish && onFinish(e);
|
|
29219
29318
|
}
|
|
29220
29319
|
};
|
|
29221
|
-
return new ReadableStream(
|
|
29222
|
-
|
|
29223
|
-
|
|
29224
|
-
|
|
29225
|
-
|
|
29226
|
-
|
|
29227
|
-
|
|
29228
|
-
|
|
29229
|
-
|
|
29230
|
-
|
|
29231
|
-
|
|
29232
|
-
|
|
29233
|
-
|
|
29320
|
+
return new ReadableStream(
|
|
29321
|
+
{
|
|
29322
|
+
async pull(controller) {
|
|
29323
|
+
try {
|
|
29324
|
+
const { done: done2, value } = await iterator2.next();
|
|
29325
|
+
if (done2) {
|
|
29326
|
+
_onFinish();
|
|
29327
|
+
controller.close();
|
|
29328
|
+
return;
|
|
29329
|
+
}
|
|
29330
|
+
let len = value.byteLength;
|
|
29331
|
+
if (onProgress) {
|
|
29332
|
+
let loadedBytes = bytes += len;
|
|
29333
|
+
onProgress(loadedBytes);
|
|
29334
|
+
}
|
|
29335
|
+
controller.enqueue(new Uint8Array(value));
|
|
29336
|
+
} catch (err) {
|
|
29337
|
+
_onFinish(err);
|
|
29338
|
+
throw err;
|
|
29234
29339
|
}
|
|
29235
|
-
|
|
29236
|
-
|
|
29237
|
-
_onFinish(
|
|
29238
|
-
|
|
29340
|
+
},
|
|
29341
|
+
cancel(reason) {
|
|
29342
|
+
_onFinish(reason);
|
|
29343
|
+
return iterator2.return();
|
|
29239
29344
|
}
|
|
29240
29345
|
},
|
|
29241
|
-
|
|
29242
|
-
|
|
29243
|
-
return iterator2.return();
|
|
29346
|
+
{
|
|
29347
|
+
highWaterMark: 2
|
|
29244
29348
|
}
|
|
29245
|
-
|
|
29246
|
-
highWaterMark: 2
|
|
29247
|
-
});
|
|
29349
|
+
);
|
|
29248
29350
|
};
|
|
29249
29351
|
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
29250
29352
|
var { isFunction } = utils$1;
|
|
@@ -29252,10 +29354,7 @@ var require_axios = __commonJS({
|
|
|
29252
29354
|
Request,
|
|
29253
29355
|
Response
|
|
29254
29356
|
}))(utils$1.global);
|
|
29255
|
-
var {
|
|
29256
|
-
ReadableStream: ReadableStream$1,
|
|
29257
|
-
TextEncoder: TextEncoder$1
|
|
29258
|
-
} = utils$1.global;
|
|
29357
|
+
var { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
|
|
29259
29358
|
var test = (fn, ...args) => {
|
|
29260
29359
|
try {
|
|
29261
29360
|
return !!fn(...args);
|
|
@@ -29264,9 +29363,13 @@ var require_axios = __commonJS({
|
|
|
29264
29363
|
}
|
|
29265
29364
|
};
|
|
29266
29365
|
var factory = (env) => {
|
|
29267
|
-
env = utils$1.merge.call(
|
|
29268
|
-
|
|
29269
|
-
|
|
29366
|
+
env = utils$1.merge.call(
|
|
29367
|
+
{
|
|
29368
|
+
skipUndefined: true
|
|
29369
|
+
},
|
|
29370
|
+
globalFetchAPI,
|
|
29371
|
+
env
|
|
29372
|
+
);
|
|
29270
29373
|
const { fetch: envFetch, Request, Response } = env;
|
|
29271
29374
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
|
|
29272
29375
|
const isRequestSupported = isFunction(Request);
|
|
@@ -29299,7 +29402,11 @@ var require_axios = __commonJS({
|
|
|
29299
29402
|
if (method) {
|
|
29300
29403
|
return method.call(res);
|
|
29301
29404
|
}
|
|
29302
|
-
throw new AxiosError$1(
|
|
29405
|
+
throw new AxiosError$1(
|
|
29406
|
+
`Response type '${type}' is not supported`,
|
|
29407
|
+
AxiosError$1.ERR_NOT_SUPPORT,
|
|
29408
|
+
config
|
|
29409
|
+
);
|
|
29303
29410
|
});
|
|
29304
29411
|
});
|
|
29305
29412
|
})();
|
|
@@ -29348,7 +29455,10 @@ var require_axios = __commonJS({
|
|
|
29348
29455
|
} = resolveConfig(config);
|
|
29349
29456
|
let _fetch = envFetch || fetch;
|
|
29350
29457
|
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
29351
|
-
let composedSignal = composeSignals$1(
|
|
29458
|
+
let composedSignal = composeSignals$1(
|
|
29459
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
29460
|
+
timeout
|
|
29461
|
+
);
|
|
29352
29462
|
let request = null;
|
|
29353
29463
|
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
29354
29464
|
composedSignal.unsubscribe();
|
|
@@ -29408,7 +29518,10 @@ var require_axios = __commonJS({
|
|
|
29408
29518
|
);
|
|
29409
29519
|
}
|
|
29410
29520
|
responseType = responseType || "text";
|
|
29411
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](
|
|
29521
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](
|
|
29522
|
+
response,
|
|
29523
|
+
config
|
|
29524
|
+
);
|
|
29412
29525
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
29413
29526
|
return await new Promise((resolve, reject) => {
|
|
29414
29527
|
settle(resolve, reject, {
|
|
@@ -29424,7 +29537,13 @@ var require_axios = __commonJS({
|
|
|
29424
29537
|
unsubscribe && unsubscribe();
|
|
29425
29538
|
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
29426
29539
|
throw Object.assign(
|
|
29427
|
-
new AxiosError$1(
|
|
29540
|
+
new AxiosError$1(
|
|
29541
|
+
"Network Error",
|
|
29542
|
+
AxiosError$1.ERR_NETWORK,
|
|
29543
|
+
config,
|
|
29544
|
+
request,
|
|
29545
|
+
err && err.response
|
|
29546
|
+
),
|
|
29428
29547
|
{
|
|
29429
29548
|
cause: err.cause || err
|
|
29430
29549
|
}
|
|
@@ -29438,11 +29557,7 @@ var require_axios = __commonJS({
|
|
|
29438
29557
|
var getFetch = (config) => {
|
|
29439
29558
|
let env = config && config.env || {};
|
|
29440
29559
|
const { fetch: fetch2, Request, Response } = env;
|
|
29441
|
-
const seeds = [
|
|
29442
|
-
Request,
|
|
29443
|
-
Response,
|
|
29444
|
-
fetch2
|
|
29445
|
-
];
|
|
29560
|
+
const seeds = [Request, Response, fetch2];
|
|
29446
29561
|
let len = seeds.length, i = len, seed, target, map = seedCache;
|
|
29447
29562
|
while (i--) {
|
|
29448
29563
|
seed = seeds[i];
|
|
@@ -29527,37 +29642,33 @@ var require_axios = __commonJS({
|
|
|
29527
29642
|
function dispatchRequest(config) {
|
|
29528
29643
|
throwIfCancellationRequested(config);
|
|
29529
29644
|
config.headers = AxiosHeaders$1.from(config.headers);
|
|
29530
|
-
config.data = transformData.call(
|
|
29531
|
-
config,
|
|
29532
|
-
config.transformRequest
|
|
29533
|
-
);
|
|
29645
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
29534
29646
|
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
29535
29647
|
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
29536
29648
|
}
|
|
29537
29649
|
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
29538
|
-
return adapter(config).then(
|
|
29539
|
-
|
|
29540
|
-
response.data = transformData.call(
|
|
29541
|
-
config,
|
|
29542
|
-
config.transformResponse,
|
|
29543
|
-
response
|
|
29544
|
-
);
|
|
29545
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
29546
|
-
return response;
|
|
29547
|
-
}, function onAdapterRejection(reason) {
|
|
29548
|
-
if (!isCancel(reason)) {
|
|
29650
|
+
return adapter(config).then(
|
|
29651
|
+
function onAdapterResolution(response) {
|
|
29549
29652
|
throwIfCancellationRequested(config);
|
|
29550
|
-
|
|
29551
|
-
|
|
29552
|
-
|
|
29553
|
-
|
|
29554
|
-
|
|
29555
|
-
|
|
29556
|
-
|
|
29653
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
29654
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
29655
|
+
return response;
|
|
29656
|
+
},
|
|
29657
|
+
function onAdapterRejection(reason) {
|
|
29658
|
+
if (!isCancel(reason)) {
|
|
29659
|
+
throwIfCancellationRequested(config);
|
|
29660
|
+
if (reason && reason.response) {
|
|
29661
|
+
reason.response.data = transformData.call(
|
|
29662
|
+
config,
|
|
29663
|
+
config.transformResponse,
|
|
29664
|
+
reason.response
|
|
29665
|
+
);
|
|
29666
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
29667
|
+
}
|
|
29557
29668
|
}
|
|
29669
|
+
return Promise.reject(reason);
|
|
29558
29670
|
}
|
|
29559
|
-
|
|
29560
|
-
});
|
|
29671
|
+
);
|
|
29561
29672
|
}
|
|
29562
29673
|
var validators$1 = {};
|
|
29563
29674
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
@@ -29608,7 +29719,10 @@ var require_axios = __commonJS({
|
|
|
29608
29719
|
const value = options[opt];
|
|
29609
29720
|
const result = value === void 0 || validator2(value, opt, options);
|
|
29610
29721
|
if (result !== true) {
|
|
29611
|
-
throw new AxiosError$1(
|
|
29722
|
+
throw new AxiosError$1(
|
|
29723
|
+
"option " + opt + " must be " + result,
|
|
29724
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
29725
|
+
);
|
|
29612
29726
|
}
|
|
29613
29727
|
continue;
|
|
29614
29728
|
}
|
|
@@ -29668,12 +29782,16 @@ var require_axios = __commonJS({
|
|
|
29668
29782
|
config = mergeConfig(this.defaults, config);
|
|
29669
29783
|
const { transitional, paramsSerializer, headers } = config;
|
|
29670
29784
|
if (transitional !== void 0) {
|
|
29671
|
-
validator.assertOptions(
|
|
29672
|
-
|
|
29673
|
-
|
|
29674
|
-
|
|
29675
|
-
|
|
29676
|
-
|
|
29785
|
+
validator.assertOptions(
|
|
29786
|
+
transitional,
|
|
29787
|
+
{
|
|
29788
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
29789
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
29790
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
29791
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
|
|
29792
|
+
},
|
|
29793
|
+
false
|
|
29794
|
+
);
|
|
29677
29795
|
}
|
|
29678
29796
|
if (paramsSerializer != null) {
|
|
29679
29797
|
if (utils$1.isFunction(paramsSerializer)) {
|
|
@@ -29681,10 +29799,14 @@ var require_axios = __commonJS({
|
|
|
29681
29799
|
serialize: paramsSerializer
|
|
29682
29800
|
};
|
|
29683
29801
|
} else {
|
|
29684
|
-
validator.assertOptions(
|
|
29685
|
-
|
|
29686
|
-
|
|
29687
|
-
|
|
29802
|
+
validator.assertOptions(
|
|
29803
|
+
paramsSerializer,
|
|
29804
|
+
{
|
|
29805
|
+
encode: validators.function,
|
|
29806
|
+
serialize: validators.function
|
|
29807
|
+
},
|
|
29808
|
+
true
|
|
29809
|
+
);
|
|
29688
29810
|
}
|
|
29689
29811
|
}
|
|
29690
29812
|
if (config.allowAbsoluteUrls !== void 0) ;
|
|
@@ -29693,21 +29815,19 @@ var require_axios = __commonJS({
|
|
|
29693
29815
|
} else {
|
|
29694
29816
|
config.allowAbsoluteUrls = true;
|
|
29695
29817
|
}
|
|
29696
|
-
validator.assertOptions(
|
|
29697
|
-
|
|
29698
|
-
|
|
29699
|
-
|
|
29700
|
-
|
|
29701
|
-
|
|
29702
|
-
|
|
29703
|
-
headers[config.method]
|
|
29704
|
-
);
|
|
29705
|
-
headers && utils$1.forEach(
|
|
29706
|
-
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
29707
|
-
(method) => {
|
|
29708
|
-
delete headers[method];
|
|
29709
|
-
}
|
|
29818
|
+
validator.assertOptions(
|
|
29819
|
+
config,
|
|
29820
|
+
{
|
|
29821
|
+
baseUrl: validators.spelling("baseURL"),
|
|
29822
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
29823
|
+
},
|
|
29824
|
+
true
|
|
29710
29825
|
);
|
|
29826
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
29827
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
29828
|
+
headers && utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
|
|
29829
|
+
delete headers[method];
|
|
29830
|
+
});
|
|
29711
29831
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
29712
29832
|
const requestInterceptorChain = [];
|
|
29713
29833
|
let synchronousRequestInterceptors = true;
|
|
@@ -29774,24 +29894,28 @@ var require_axios = __commonJS({
|
|
|
29774
29894
|
};
|
|
29775
29895
|
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
29776
29896
|
Axios.prototype[method] = function(url2, config) {
|
|
29777
|
-
return this.request(
|
|
29778
|
-
|
|
29779
|
-
|
|
29780
|
-
|
|
29781
|
-
|
|
29897
|
+
return this.request(
|
|
29898
|
+
mergeConfig(config || {}, {
|
|
29899
|
+
method,
|
|
29900
|
+
url: url2,
|
|
29901
|
+
data: (config || {}).data
|
|
29902
|
+
})
|
|
29903
|
+
);
|
|
29782
29904
|
};
|
|
29783
29905
|
});
|
|
29784
29906
|
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
29785
29907
|
function generateHTTPMethod(isForm) {
|
|
29786
29908
|
return function httpMethod(url2, data, config) {
|
|
29787
|
-
return this.request(
|
|
29788
|
-
|
|
29789
|
-
|
|
29790
|
-
|
|
29791
|
-
|
|
29792
|
-
|
|
29793
|
-
|
|
29794
|
-
|
|
29909
|
+
return this.request(
|
|
29910
|
+
mergeConfig(config || {}, {
|
|
29911
|
+
method,
|
|
29912
|
+
headers: isForm ? {
|
|
29913
|
+
"Content-Type": "multipart/form-data"
|
|
29914
|
+
} : {},
|
|
29915
|
+
url: url2,
|
|
29916
|
+
data
|
|
29917
|
+
})
|
|
29918
|
+
);
|
|
29795
29919
|
};
|
|
29796
29920
|
}
|
|
29797
29921
|
Axios.prototype[method] = generateHTTPMethod();
|
|
@@ -30687,6 +30811,7 @@ function buildGenerateResult(config) {
|
|
|
30687
30811
|
response: {
|
|
30688
30812
|
body: rawResponseBody,
|
|
30689
30813
|
headers: responseHeaders,
|
|
30814
|
+
id: response.responseId,
|
|
30690
30815
|
modelId,
|
|
30691
30816
|
timestamp: /* @__PURE__ */ new Date()
|
|
30692
30817
|
},
|
|
@@ -30875,6 +31000,7 @@ function createStreamTransformer(config) {
|
|
|
30875
31000
|
modelId,
|
|
30876
31001
|
options,
|
|
30877
31002
|
providerName,
|
|
31003
|
+
responseHeaders,
|
|
30878
31004
|
responseId,
|
|
30879
31005
|
sdkStream,
|
|
30880
31006
|
streamResponseGetFinishReason,
|
|
@@ -30886,131 +31012,11 @@ function createStreamTransformer(config) {
|
|
|
30886
31012
|
let textBlockId = null;
|
|
30887
31013
|
const streamState = createInitialStreamState();
|
|
30888
31014
|
const toolCallsInProgress = /* @__PURE__ */ new Map();
|
|
30889
|
-
return
|
|
30890
|
-
|
|
30891
|
-
|
|
30892
|
-
|
|
30893
|
-
controller
|
|
30894
|
-
type: "stream-start",
|
|
30895
|
-
warnings: [...warnings]
|
|
30896
|
-
});
|
|
30897
|
-
try {
|
|
30898
|
-
for await (const chunk of sdkStream) {
|
|
30899
|
-
if (includeRawChunks) {
|
|
30900
|
-
controller.enqueue({
|
|
30901
|
-
rawValue: chunk._data ?? chunk,
|
|
30902
|
-
type: "raw"
|
|
30903
|
-
});
|
|
30904
|
-
}
|
|
30905
|
-
if (streamState.isFirstChunk) {
|
|
30906
|
-
streamState.isFirstChunk = false;
|
|
30907
|
-
controller.enqueue({
|
|
30908
|
-
id: responseId,
|
|
30909
|
-
modelId,
|
|
30910
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
30911
|
-
type: "response-metadata"
|
|
30912
|
-
});
|
|
30913
|
-
}
|
|
30914
|
-
const deltaToolCalls = chunk.getDeltaToolCalls();
|
|
30915
|
-
if (Array.isArray(deltaToolCalls) && deltaToolCalls.length > 0) {
|
|
30916
|
-
streamState.finishReason = {
|
|
30917
|
-
raw: void 0,
|
|
30918
|
-
unified: "tool-calls"
|
|
30919
|
-
};
|
|
30920
|
-
}
|
|
30921
|
-
const deltaContent = chunk.getDeltaContent();
|
|
30922
|
-
if (typeof deltaContent === "string" && deltaContent.length > 0 && streamState.finishReason.unified !== "tool-calls") {
|
|
30923
|
-
if (!streamState.activeText) {
|
|
30924
|
-
textBlockId = idGenerator.generateTextBlockId();
|
|
30925
|
-
controller.enqueue({ id: textBlockId, type: "text-start" });
|
|
30926
|
-
streamState.activeText = true;
|
|
30927
|
-
}
|
|
30928
|
-
if (textBlockId) {
|
|
30929
|
-
controller.enqueue({
|
|
30930
|
-
delta: deltaContent,
|
|
30931
|
-
id: textBlockId,
|
|
30932
|
-
type: "text-delta"
|
|
30933
|
-
});
|
|
30934
|
-
}
|
|
30935
|
-
}
|
|
30936
|
-
if (Array.isArray(deltaToolCalls) && deltaToolCalls.length > 0) {
|
|
30937
|
-
for (const toolCallChunk of deltaToolCalls) {
|
|
30938
|
-
const index = toolCallChunk.index;
|
|
30939
|
-
if (typeof index !== "number" || !Number.isFinite(index)) {
|
|
30940
|
-
continue;
|
|
30941
|
-
}
|
|
30942
|
-
if (!toolCallsInProgress.has(index)) {
|
|
30943
|
-
toolCallsInProgress.set(index, {
|
|
30944
|
-
arguments: "",
|
|
30945
|
-
didEmitCall: false,
|
|
30946
|
-
didEmitInputStart: false,
|
|
30947
|
-
id: toolCallChunk.id ?? `tool_${String(index)}`,
|
|
30948
|
-
toolName: toolCallChunk.function?.name
|
|
30949
|
-
});
|
|
30950
|
-
}
|
|
30951
|
-
const tc = toolCallsInProgress.get(index);
|
|
30952
|
-
if (!tc) continue;
|
|
30953
|
-
if (toolCallChunk.id) {
|
|
30954
|
-
tc.id = toolCallChunk.id;
|
|
30955
|
-
}
|
|
30956
|
-
const nextToolName = toolCallChunk.function?.name;
|
|
30957
|
-
if (typeof nextToolName === "string" && nextToolName.length > 0) {
|
|
30958
|
-
tc.toolName = nextToolName;
|
|
30959
|
-
}
|
|
30960
|
-
if (!tc.didEmitInputStart && tc.toolName) {
|
|
30961
|
-
tc.didEmitInputStart = true;
|
|
30962
|
-
controller.enqueue({
|
|
30963
|
-
id: tc.id,
|
|
30964
|
-
toolName: tc.toolName,
|
|
30965
|
-
type: "tool-input-start"
|
|
30966
|
-
});
|
|
30967
|
-
}
|
|
30968
|
-
const argumentsDelta = toolCallChunk.function?.arguments;
|
|
30969
|
-
if (typeof argumentsDelta === "string" && argumentsDelta.length > 0) {
|
|
30970
|
-
tc.arguments += argumentsDelta;
|
|
30971
|
-
if (tc.didEmitInputStart) {
|
|
30972
|
-
controller.enqueue({
|
|
30973
|
-
delta: argumentsDelta,
|
|
30974
|
-
id: tc.id,
|
|
30975
|
-
type: "tool-input-delta"
|
|
30976
|
-
});
|
|
30977
|
-
}
|
|
30978
|
-
}
|
|
30979
|
-
}
|
|
30980
|
-
}
|
|
30981
|
-
const chunkFinishReason = chunk.getFinishReason();
|
|
30982
|
-
if (chunkFinishReason) {
|
|
30983
|
-
streamState.finishReason = mapFinishReason(chunkFinishReason);
|
|
30984
|
-
if (streamState.finishReason.unified === "tool-calls") {
|
|
30985
|
-
const toolCalls2 = Array.from(toolCallsInProgress.values());
|
|
30986
|
-
for (const tc of toolCalls2) {
|
|
30987
|
-
if (tc.didEmitCall) {
|
|
30988
|
-
continue;
|
|
30989
|
-
}
|
|
30990
|
-
if (!tc.didEmitInputStart) {
|
|
30991
|
-
tc.didEmitInputStart = true;
|
|
30992
|
-
controller.enqueue({
|
|
30993
|
-
id: tc.id,
|
|
30994
|
-
toolName: tc.toolName ?? "",
|
|
30995
|
-
type: "tool-input-start"
|
|
30996
|
-
});
|
|
30997
|
-
}
|
|
30998
|
-
tc.didEmitCall = true;
|
|
30999
|
-
controller.enqueue({ id: tc.id, type: "tool-input-end" });
|
|
31000
|
-
controller.enqueue({
|
|
31001
|
-
input: tc.arguments,
|
|
31002
|
-
toolCallId: tc.id,
|
|
31003
|
-
toolName: tc.toolName ?? "",
|
|
31004
|
-
type: "tool-call"
|
|
31005
|
-
});
|
|
31006
|
-
}
|
|
31007
|
-
if (streamState.activeText && textBlockId) {
|
|
31008
|
-
controller.enqueue({ id: textBlockId, type: "text-end" });
|
|
31009
|
-
streamState.activeText = false;
|
|
31010
|
-
}
|
|
31011
|
-
}
|
|
31012
|
-
}
|
|
31013
|
-
}
|
|
31015
|
+
return (0, import_provider_utils2.convertAsyncIteratorToReadableStream)(
|
|
31016
|
+
safeIterate(sdkStream)[Symbol.asyncIterator]()
|
|
31017
|
+
).pipeThrough(
|
|
31018
|
+
new TransformStream({
|
|
31019
|
+
flush(controller) {
|
|
31014
31020
|
const toolCalls = Array.from(toolCallsInProgress.values());
|
|
31015
31021
|
let didEmitAnyToolCalls = false;
|
|
31016
31022
|
for (const tc of toolCalls) {
|
|
@@ -31059,6 +31065,7 @@ function createStreamTransformer(config) {
|
|
|
31059
31065
|
providerMetadata: {
|
|
31060
31066
|
[providerName]: {
|
|
31061
31067
|
finishReason: streamState.finishReason.raw,
|
|
31068
|
+
...typeof responseHeaders?.["x-request-id"] === "string" ? { requestId: responseHeaders["x-request-id"] } : {},
|
|
31062
31069
|
responseId,
|
|
31063
31070
|
version: version2
|
|
31064
31071
|
}
|
|
@@ -31066,21 +31073,144 @@ function createStreamTransformer(config) {
|
|
|
31066
31073
|
type: "finish",
|
|
31067
31074
|
usage: streamState.usage
|
|
31068
31075
|
});
|
|
31069
|
-
|
|
31070
|
-
|
|
31071
|
-
const aiError = convertToAISDKError2(error, {
|
|
31072
|
-
operation: "doStream",
|
|
31073
|
-
requestBody: createAISDKRequestBodySummary(options),
|
|
31074
|
-
url
|
|
31075
|
-
});
|
|
31076
|
+
},
|
|
31077
|
+
start(controller) {
|
|
31076
31078
|
controller.enqueue({
|
|
31077
|
-
|
|
31078
|
-
|
|
31079
|
+
type: "stream-start",
|
|
31080
|
+
warnings: [...warnings]
|
|
31079
31081
|
});
|
|
31080
|
-
|
|
31082
|
+
},
|
|
31083
|
+
transform(chunk, controller) {
|
|
31084
|
+
if (chunk instanceof Error) {
|
|
31085
|
+
const aiError = convertToAISDKError2(chunk, {
|
|
31086
|
+
operation: "doStream",
|
|
31087
|
+
requestBody: createAISDKRequestBodySummary(options),
|
|
31088
|
+
url
|
|
31089
|
+
});
|
|
31090
|
+
controller.enqueue({
|
|
31091
|
+
error: aiError instanceof Error ? aiError : new Error(String(aiError)),
|
|
31092
|
+
type: "error"
|
|
31093
|
+
});
|
|
31094
|
+
controller.terminate();
|
|
31095
|
+
return;
|
|
31096
|
+
}
|
|
31097
|
+
if (includeRawChunks) {
|
|
31098
|
+
controller.enqueue({
|
|
31099
|
+
rawValue: chunk._data ?? chunk,
|
|
31100
|
+
type: "raw"
|
|
31101
|
+
});
|
|
31102
|
+
}
|
|
31103
|
+
if (streamState.isFirstChunk) {
|
|
31104
|
+
streamState.isFirstChunk = false;
|
|
31105
|
+
controller.enqueue({
|
|
31106
|
+
id: responseId,
|
|
31107
|
+
modelId,
|
|
31108
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
31109
|
+
type: "response-metadata"
|
|
31110
|
+
});
|
|
31111
|
+
}
|
|
31112
|
+
const deltaToolCalls = chunk.getDeltaToolCalls();
|
|
31113
|
+
if (Array.isArray(deltaToolCalls) && deltaToolCalls.length > 0) {
|
|
31114
|
+
streamState.finishReason = {
|
|
31115
|
+
raw: void 0,
|
|
31116
|
+
unified: "tool-calls"
|
|
31117
|
+
};
|
|
31118
|
+
}
|
|
31119
|
+
const deltaContent = chunk.getDeltaContent();
|
|
31120
|
+
if (typeof deltaContent === "string" && deltaContent.length > 0 && streamState.finishReason.unified !== "tool-calls") {
|
|
31121
|
+
if (!streamState.activeText) {
|
|
31122
|
+
textBlockId = idGenerator.generateTextBlockId();
|
|
31123
|
+
controller.enqueue({ id: textBlockId, type: "text-start" });
|
|
31124
|
+
streamState.activeText = true;
|
|
31125
|
+
}
|
|
31126
|
+
if (textBlockId) {
|
|
31127
|
+
controller.enqueue({
|
|
31128
|
+
delta: deltaContent,
|
|
31129
|
+
id: textBlockId,
|
|
31130
|
+
type: "text-delta"
|
|
31131
|
+
});
|
|
31132
|
+
}
|
|
31133
|
+
}
|
|
31134
|
+
if (Array.isArray(deltaToolCalls) && deltaToolCalls.length > 0) {
|
|
31135
|
+
for (const toolCallChunk of deltaToolCalls) {
|
|
31136
|
+
const index = toolCallChunk.index;
|
|
31137
|
+
if (typeof index !== "number" || !Number.isFinite(index)) {
|
|
31138
|
+
continue;
|
|
31139
|
+
}
|
|
31140
|
+
if (!toolCallsInProgress.has(index)) {
|
|
31141
|
+
toolCallsInProgress.set(index, {
|
|
31142
|
+
arguments: "",
|
|
31143
|
+
didEmitCall: false,
|
|
31144
|
+
didEmitInputStart: false,
|
|
31145
|
+
id: toolCallChunk.id ?? `tool_${String(index)}`,
|
|
31146
|
+
toolName: toolCallChunk.function?.name
|
|
31147
|
+
});
|
|
31148
|
+
}
|
|
31149
|
+
const tc = toolCallsInProgress.get(index);
|
|
31150
|
+
if (!tc) continue;
|
|
31151
|
+
if (toolCallChunk.id) {
|
|
31152
|
+
tc.id = toolCallChunk.id;
|
|
31153
|
+
}
|
|
31154
|
+
const nextToolName = toolCallChunk.function?.name;
|
|
31155
|
+
if (typeof nextToolName === "string" && nextToolName.length > 0) {
|
|
31156
|
+
tc.toolName = nextToolName;
|
|
31157
|
+
}
|
|
31158
|
+
if (!tc.didEmitInputStart && tc.toolName) {
|
|
31159
|
+
tc.didEmitInputStart = true;
|
|
31160
|
+
controller.enqueue({
|
|
31161
|
+
id: tc.id,
|
|
31162
|
+
toolName: tc.toolName,
|
|
31163
|
+
type: "tool-input-start"
|
|
31164
|
+
});
|
|
31165
|
+
}
|
|
31166
|
+
const argumentsDelta = toolCallChunk.function?.arguments;
|
|
31167
|
+
if (typeof argumentsDelta === "string" && argumentsDelta.length > 0) {
|
|
31168
|
+
tc.arguments += argumentsDelta;
|
|
31169
|
+
if (tc.didEmitInputStart) {
|
|
31170
|
+
controller.enqueue({
|
|
31171
|
+
delta: argumentsDelta,
|
|
31172
|
+
id: tc.id,
|
|
31173
|
+
type: "tool-input-delta"
|
|
31174
|
+
});
|
|
31175
|
+
}
|
|
31176
|
+
}
|
|
31177
|
+
}
|
|
31178
|
+
}
|
|
31179
|
+
const chunkFinishReason = chunk.getFinishReason();
|
|
31180
|
+
if (chunkFinishReason) {
|
|
31181
|
+
streamState.finishReason = mapFinishReason(chunkFinishReason);
|
|
31182
|
+
if (streamState.finishReason.unified === "tool-calls") {
|
|
31183
|
+
const toolCalls = Array.from(toolCallsInProgress.values());
|
|
31184
|
+
for (const tc of toolCalls) {
|
|
31185
|
+
if (tc.didEmitCall) {
|
|
31186
|
+
continue;
|
|
31187
|
+
}
|
|
31188
|
+
if (!tc.didEmitInputStart) {
|
|
31189
|
+
tc.didEmitInputStart = true;
|
|
31190
|
+
controller.enqueue({
|
|
31191
|
+
id: tc.id,
|
|
31192
|
+
toolName: tc.toolName ?? "",
|
|
31193
|
+
type: "tool-input-start"
|
|
31194
|
+
});
|
|
31195
|
+
}
|
|
31196
|
+
tc.didEmitCall = true;
|
|
31197
|
+
controller.enqueue({ id: tc.id, type: "tool-input-end" });
|
|
31198
|
+
controller.enqueue({
|
|
31199
|
+
input: tc.arguments,
|
|
31200
|
+
toolCallId: tc.id,
|
|
31201
|
+
toolName: tc.toolName ?? "",
|
|
31202
|
+
type: "tool-call"
|
|
31203
|
+
});
|
|
31204
|
+
}
|
|
31205
|
+
if (streamState.activeText && textBlockId) {
|
|
31206
|
+
controller.enqueue({ id: textBlockId, type: "text-end" });
|
|
31207
|
+
streamState.activeText = false;
|
|
31208
|
+
}
|
|
31209
|
+
}
|
|
31210
|
+
}
|
|
31081
31211
|
}
|
|
31082
|
-
}
|
|
31083
|
-
|
|
31212
|
+
})
|
|
31213
|
+
);
|
|
31084
31214
|
}
|
|
31085
31215
|
function extractResponseContent(response) {
|
|
31086
31216
|
const content = [];
|
|
@@ -31223,6 +31353,13 @@ async function prepareEmbeddingCall(config, options) {
|
|
|
31223
31353
|
}
|
|
31224
31354
|
return { embeddingOptions: sapOptions, providerName };
|
|
31225
31355
|
}
|
|
31356
|
+
async function* safeIterate(iterable) {
|
|
31357
|
+
try {
|
|
31358
|
+
yield* iterable;
|
|
31359
|
+
} catch (error) {
|
|
31360
|
+
yield error instanceof Error ? error : new Error(String(error));
|
|
31361
|
+
}
|
|
31362
|
+
}
|
|
31226
31363
|
var import_provider3, import_provider_utils2, import_zod2, StreamIdGenerator;
|
|
31227
31364
|
var init_strategy_utils = __esm({
|
|
31228
31365
|
"src/strategy-utils.ts"() {
|
|
@@ -31255,7 +31392,7 @@ var VERSION;
|
|
|
31255
31392
|
var init_version = __esm({
|
|
31256
31393
|
"src/version.ts"() {
|
|
31257
31394
|
"use strict";
|
|
31258
|
-
VERSION = true ? "4.
|
|
31395
|
+
VERSION = true ? "4.5.0" : "0.0.0-test";
|
|
31259
31396
|
}
|
|
31260
31397
|
});
|
|
31261
31398
|
|
|
@@ -31490,7 +31627,7 @@ var init_base_language_model_strategy = __esm({
|
|
|
31490
31627
|
settings
|
|
31491
31628
|
);
|
|
31492
31629
|
const idGenerator = new StreamIdGenerator();
|
|
31493
|
-
const responseId = idGenerator.generateResponseId();
|
|
31630
|
+
const responseId = streamResponse.responseId ?? idGenerator.generateResponseId();
|
|
31494
31631
|
const streamWarnings = this.collectStreamWarnings(settings, commonParts.sapOptions);
|
|
31495
31632
|
const transformedStream = createStreamTransformer({
|
|
31496
31633
|
convertToAISDKError,
|
|
@@ -31499,6 +31636,7 @@ var init_base_language_model_strategy = __esm({
|
|
|
31499
31636
|
modelId: config.modelId,
|
|
31500
31637
|
options,
|
|
31501
31638
|
providerName: commonParts.providerName,
|
|
31639
|
+
responseHeaders: streamResponse.responseHeaders,
|
|
31502
31640
|
responseId,
|
|
31503
31641
|
sdkStream: streamResponse.stream,
|
|
31504
31642
|
streamResponseGetFinishReason: streamResponse.getFinishReason,
|
|
@@ -31511,6 +31649,9 @@ var init_base_language_model_strategy = __esm({
|
|
|
31511
31649
|
request: {
|
|
31512
31650
|
body: request
|
|
31513
31651
|
},
|
|
31652
|
+
response: {
|
|
31653
|
+
headers: streamResponse.responseHeaders
|
|
31654
|
+
},
|
|
31514
31655
|
stream: transformedStream
|
|
31515
31656
|
};
|
|
31516
31657
|
} catch (error) {
|
|
@@ -31603,6 +31744,7 @@ var init_foundation_models_language_model_strategy = __esm({
|
|
|
31603
31744
|
"src/foundation-models-language-model-strategy.ts"() {
|
|
31604
31745
|
"use strict";
|
|
31605
31746
|
init_base_language_model_strategy();
|
|
31747
|
+
init_sap_ai_error();
|
|
31606
31748
|
init_strategy_utils();
|
|
31607
31749
|
FOUNDATION_MODELS_PARAM_MAPPINGS = [
|
|
31608
31750
|
...BaseLanguageModelStrategy.COMMON_PARAM_MAPPINGS,
|
|
@@ -31650,13 +31792,16 @@ var init_foundation_models_language_model_strategy = __esm({
|
|
|
31650
31792
|
}
|
|
31651
31793
|
async executeApiCall(client, request, abortSignal) {
|
|
31652
31794
|
const response = await client.run(request, abortSignal ? { signal: abortSignal } : void 0);
|
|
31795
|
+
const headers = normalizeHeaders(response.rawResponse.headers);
|
|
31796
|
+
const completionId = response._data?.id ?? headers?.["x-request-id"];
|
|
31653
31797
|
return {
|
|
31654
31798
|
getContent: () => response.getContent(),
|
|
31655
31799
|
getFinishReason: () => response.getFinishReason(),
|
|
31656
31800
|
getTokenUsage: () => response.getTokenUsage(),
|
|
31657
31801
|
getToolCalls: () => response.getToolCalls(),
|
|
31658
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
31659
|
-
rawResponse: { headers: response.rawResponse.headers }
|
|
31802
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- SAP SDK types headers as any
|
|
31803
|
+
rawResponse: { headers: response.rawResponse.headers },
|
|
31804
|
+
responseId: completionId
|
|
31660
31805
|
};
|
|
31661
31806
|
}
|
|
31662
31807
|
async executeStreamCall(client, request, abortSignal, _settings) {
|
|
@@ -31722,6 +31867,7 @@ var init_orchestration_language_model_strategy = __esm({
|
|
|
31722
31867
|
init_base_language_model_strategy();
|
|
31723
31868
|
init_convert_to_sap_messages();
|
|
31724
31869
|
init_deep_merge();
|
|
31870
|
+
init_sap_ai_error();
|
|
31725
31871
|
init_sap_ai_provider_options();
|
|
31726
31872
|
init_strategy_utils();
|
|
31727
31873
|
RESOLVED_CONFIG_REF_KEY = "_resolvedConfigRef";
|
|
@@ -31843,6 +31989,13 @@ var init_orchestration_language_model_strategy = __esm({
|
|
|
31843
31989
|
prompt: promptConfig
|
|
31844
31990
|
}
|
|
31845
31991
|
};
|
|
31992
|
+
if (settings.fallbackModuleConfigs && settings.fallbackModuleConfigs.length > 0) {
|
|
31993
|
+
const configList = [
|
|
31994
|
+
clientConfig,
|
|
31995
|
+
...settings.fallbackModuleConfigs
|
|
31996
|
+
];
|
|
31997
|
+
return new this.ClientClass(configList, config.deploymentConfig, config.destination);
|
|
31998
|
+
}
|
|
31846
31999
|
return new this.ClientClass(clientConfig, config.deploymentConfig, config.destination);
|
|
31847
32000
|
}
|
|
31848
32001
|
async executeApiCall(client, request, abortSignal) {
|
|
@@ -31850,21 +32003,26 @@ var init_orchestration_language_model_strategy = __esm({
|
|
|
31850
32003
|
request,
|
|
31851
32004
|
abortSignal ? { signal: abortSignal } : void 0
|
|
31852
32005
|
);
|
|
32006
|
+
const completionId = response._data?.final_result?.id ?? response.getRequestId();
|
|
31853
32007
|
return {
|
|
31854
32008
|
getContent: () => response.getContent(),
|
|
31855
32009
|
getFinishReason: () => response.getFinishReason(),
|
|
31856
32010
|
getTokenUsage: () => response.getTokenUsage(),
|
|
31857
32011
|
getToolCalls: () => response.getToolCalls(),
|
|
31858
32012
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- SAP SDK types headers as any
|
|
31859
|
-
rawResponse: { headers: response.rawResponse.headers }
|
|
32013
|
+
rawResponse: { headers: response.rawResponse.headers },
|
|
32014
|
+
responseId: completionId
|
|
31860
32015
|
};
|
|
31861
32016
|
}
|
|
31862
32017
|
async executeStreamCall(client, request, abortSignal, settings) {
|
|
31863
32018
|
const sdkStreamOptions = this.buildSdkStreamOptions(settings.streamOptions);
|
|
31864
32019
|
const streamResponse = await client.stream(request, abortSignal, sdkStreamOptions);
|
|
32020
|
+
const streamCompletionId = streamResponse._data?.final_result?.id;
|
|
31865
32021
|
return {
|
|
31866
32022
|
getFinishReason: () => streamResponse.getFinishReason(),
|
|
31867
32023
|
getTokenUsage: () => streamResponse.getTokenUsage(),
|
|
32024
|
+
responseHeaders: normalizeHeaders(streamResponse.rawResponse.headers),
|
|
32025
|
+
responseId: streamCompletionId,
|
|
31868
32026
|
stream: streamResponse.stream
|
|
31869
32027
|
};
|
|
31870
32028
|
}
|
|
@@ -32698,6 +32856,6 @@ mime-types/index.js:
|
|
|
32698
32856
|
*)
|
|
32699
32857
|
|
|
32700
32858
|
axios/dist/node/axios.cjs:
|
|
32701
|
-
(*! Axios v1.13.
|
|
32859
|
+
(*! Axios v1.13.6 Copyright (c) 2026 Matt Zabriskie and contributors *)
|
|
32702
32860
|
*/
|
|
32703
32861
|
//# sourceMappingURL=index.cjs.map
|