@jerome-benoit/sap-ai-provider 4.6.3 → 4.6.5
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/{chunk-7ZKPZONG.js → chunk-DVRCVX3D.js} +24 -17
- package/dist/{chunk-7ZKPZONG.js.map → chunk-DVRCVX3D.js.map} +1 -1
- package/dist/{chunk-5FHTB5RT.js → chunk-IW3HT2O2.js} +3 -3
- package/dist/{chunk-WLW2XIIX.js → chunk-MUVZG52Z.js} +2 -2
- package/dist/{chunk-RHZV73MM.js → chunk-RIDFTJHB.js} +3 -3
- package/dist/{foundation-models-embedding-model-strategy-FHJ3PW42.js → foundation-models-embedding-model-strategy-LVCLPX77.js} +4 -4
- package/dist/{foundation-models-language-model-strategy-XQ24PJK4.js → foundation-models-language-model-strategy-PZMQYE3T.js} +4 -4
- package/dist/index.cjs +23 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/{orchestration-embedding-model-strategy-FKAUQZH2.js → orchestration-embedding-model-strategy-SJ6AR4CA.js} +4 -4
- package/dist/{orchestration-language-model-strategy-TSZQCLG3.js → orchestration-language-model-strategy-B36B6QYQ.js} +4 -4
- package/package.json +1 -1
- /package/dist/{chunk-5FHTB5RT.js.map → chunk-IW3HT2O2.js.map} +0 -0
- /package/dist/{chunk-WLW2XIIX.js.map → chunk-MUVZG52Z.js.map} +0 -0
- /package/dist/{chunk-RHZV73MM.js.map → chunk-RIDFTJHB.js.map} +0 -0
- /package/dist/{foundation-models-embedding-model-strategy-FHJ3PW42.js.map → foundation-models-embedding-model-strategy-LVCLPX77.js.map} +0 -0
- /package/dist/{foundation-models-language-model-strategy-XQ24PJK4.js.map → foundation-models-language-model-strategy-PZMQYE3T.js.map} +0 -0
- /package/dist/{orchestration-embedding-model-strategy-FKAUQZH2.js.map → orchestration-embedding-model-strategy-SJ6AR4CA.js.map} +0 -0
- /package/dist/{orchestration-language-model-strategy-TSZQCLG3.js.map → orchestration-language-model-strategy-B36B6QYQ.js.map} +0 -0
|
@@ -30051,7 +30051,7 @@ var UnsupportedFeatureError = class extends Error {
|
|
|
30051
30051
|
};
|
|
30052
30052
|
function convertSAPErrorToAPICallError(errorResponse, context) {
|
|
30053
30053
|
const { code, location, message, requestId } = extractErrorFields(errorResponse);
|
|
30054
|
-
const statusCode = getStatusCodeFromSAPError(code);
|
|
30054
|
+
const statusCode = getStatusCodeFromSAPError(code, context?.httpStatusCode);
|
|
30055
30055
|
const responseBody = JSON.stringify({
|
|
30056
30056
|
error: {
|
|
30057
30057
|
code,
|
|
@@ -30112,10 +30112,11 @@ function convertToAISDKError(error, context) {
|
|
|
30112
30112
|
return error;
|
|
30113
30113
|
}
|
|
30114
30114
|
const rootError = getRootError(error);
|
|
30115
|
-
const errorResponse =
|
|
30115
|
+
const errorResponse = findStructuredErrorResponse(error);
|
|
30116
30116
|
if (errorResponse) {
|
|
30117
30117
|
return convertSAPErrorToAPICallError(errorResponse, {
|
|
30118
30118
|
...context,
|
|
30119
|
+
httpStatusCode: getAxiosError(error)?.response?.status,
|
|
30119
30120
|
responseHeaders: context?.responseHeaders ?? getAxiosResponseHeaders(error)
|
|
30120
30121
|
});
|
|
30121
30122
|
}
|
|
@@ -30276,7 +30277,7 @@ function extractModelIdentifier(message, location) {
|
|
|
30276
30277
|
return void 0;
|
|
30277
30278
|
}
|
|
30278
30279
|
function extractSAPErrorMessage(error) {
|
|
30279
|
-
const errorResponse =
|
|
30280
|
+
const errorResponse = findStructuredErrorResponse(error);
|
|
30280
30281
|
if (errorResponse) {
|
|
30281
30282
|
return extractErrorFields(errorResponse).message;
|
|
30282
30283
|
}
|
|
@@ -30286,14 +30287,18 @@ function extractSAPErrorMessage(error) {
|
|
|
30286
30287
|
}
|
|
30287
30288
|
return typeof rootError === "string" ? rootError : void 0;
|
|
30288
30289
|
}
|
|
30289
|
-
function
|
|
30290
|
+
function findStructuredErrorResponse(error) {
|
|
30290
30291
|
const rootError = getRootError(error);
|
|
30291
|
-
if (
|
|
30292
|
+
if (isStructuredErrorResponse(rootError)) {
|
|
30292
30293
|
return rootError;
|
|
30293
30294
|
}
|
|
30295
|
+
const axiosData = getAxiosError(error)?.response?.data;
|
|
30296
|
+
if (axiosData && isStructuredErrorResponse(axiosData)) {
|
|
30297
|
+
return axiosData;
|
|
30298
|
+
}
|
|
30294
30299
|
if (rootError instanceof Error) {
|
|
30295
30300
|
const parsed = tryExtractSAPErrorFromMessage(rootError.message);
|
|
30296
|
-
if (parsed &&
|
|
30301
|
+
if (parsed && isStructuredErrorResponse(parsed)) {
|
|
30297
30302
|
return parsed;
|
|
30298
30303
|
}
|
|
30299
30304
|
}
|
|
@@ -30320,11 +30325,13 @@ function getAxiosResponseHeaders(error) {
|
|
|
30320
30325
|
function getRootError(error) {
|
|
30321
30326
|
return error instanceof Error && (0, import_util.isErrorWithCause)(error) ? error.rootCause : error;
|
|
30322
30327
|
}
|
|
30323
|
-
function getStatusCodeFromSAPError(code) {
|
|
30324
|
-
if (
|
|
30325
|
-
if (code >= 100 && code < 600) {
|
|
30328
|
+
function getStatusCodeFromSAPError(code, httpStatusCode) {
|
|
30329
|
+
if (code && code >= 100 && code < 600) {
|
|
30326
30330
|
return code;
|
|
30327
30331
|
}
|
|
30332
|
+
if (httpStatusCode && httpStatusCode >= 100 && httpStatusCode < 600) {
|
|
30333
|
+
return httpStatusCode;
|
|
30334
|
+
}
|
|
30328
30335
|
return HTTP_STATUS.INTERNAL_ERROR;
|
|
30329
30336
|
}
|
|
30330
30337
|
function isAbortError(error) {
|
|
@@ -30336,7 +30343,10 @@ function isAbortError(error) {
|
|
|
30336
30343
|
}
|
|
30337
30344
|
return false;
|
|
30338
30345
|
}
|
|
30339
|
-
function
|
|
30346
|
+
function isRetryable(statusCode) {
|
|
30347
|
+
return statusCode === HTTP_STATUS.REQUEST_TIMEOUT || statusCode === HTTP_STATUS.CONFLICT || statusCode === HTTP_STATUS.RATE_LIMIT || statusCode >= HTTP_STATUS.INTERNAL_ERROR && statusCode < 600;
|
|
30348
|
+
}
|
|
30349
|
+
function isStructuredErrorResponse(error) {
|
|
30340
30350
|
if (error === null || typeof error !== "object" || !("error" in error)) {
|
|
30341
30351
|
return false;
|
|
30342
30352
|
}
|
|
@@ -30352,7 +30362,7 @@ function isOrchestrationErrorResponse(error) {
|
|
|
30352
30362
|
if (typeof errorEntry.message !== "string") {
|
|
30353
30363
|
return false;
|
|
30354
30364
|
}
|
|
30355
|
-
if ("code" in entry && typeof errorEntry.code !== "number") {
|
|
30365
|
+
if ("code" in entry && errorEntry.code != null && typeof errorEntry.code !== "number") {
|
|
30356
30366
|
return false;
|
|
30357
30367
|
}
|
|
30358
30368
|
return true;
|
|
@@ -30365,14 +30375,11 @@ function isOrchestrationErrorResponse(error) {
|
|
|
30365
30375
|
if (typeof errorObj.message !== "string") {
|
|
30366
30376
|
return false;
|
|
30367
30377
|
}
|
|
30368
|
-
if ("code" in innerError && typeof errorObj.code !== "number") {
|
|
30378
|
+
if ("code" in innerError && errorObj.code != null && typeof errorObj.code !== "number") {
|
|
30369
30379
|
return false;
|
|
30370
30380
|
}
|
|
30371
30381
|
return true;
|
|
30372
30382
|
}
|
|
30373
|
-
function isRetryable(statusCode) {
|
|
30374
|
-
return statusCode === HTTP_STATUS.REQUEST_TIMEOUT || statusCode === HTTP_STATUS.CONFLICT || statusCode === HTTP_STATUS.RATE_LIMIT || statusCode >= HTTP_STATUS.INTERNAL_ERROR && statusCode < 600;
|
|
30375
|
-
}
|
|
30376
30383
|
function serializeAxiosResponseData(data, maxLength = 2e3) {
|
|
30377
30384
|
if (data === void 0) return void 0;
|
|
30378
30385
|
let serialized;
|
|
@@ -30408,7 +30415,7 @@ function tryExtractSAPErrorFromMessage(message) {
|
|
|
30408
30415
|
}
|
|
30409
30416
|
|
|
30410
30417
|
// src/version.ts
|
|
30411
|
-
var VERSION = true ? "4.6.
|
|
30418
|
+
var VERSION = true ? "4.6.5" : "0.0.0-test";
|
|
30412
30419
|
|
|
30413
30420
|
export {
|
|
30414
30421
|
__toESM,
|
|
@@ -30462,4 +30469,4 @@ mime-types/index.js:
|
|
|
30462
30469
|
axios/dist/node/axios.cjs:
|
|
30463
30470
|
(*! Axios v1.14.0 Copyright (c) 2026 Matt Zabriskie and contributors *)
|
|
30464
30471
|
*/
|
|
30465
|
-
//# sourceMappingURL=chunk-
|
|
30472
|
+
//# sourceMappingURL=chunk-DVRCVX3D.js.map
|