@sapui5/sap.ushell_abap 1.150.1 → 1.152.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/package.json +1 -1
- package/src/main/js/sap/ushell_abap/.library +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +30 -31
- package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +5 -5
- package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +19 -24
- package/src/main/js/sap/ushell_abap/adapters/abap/CommonDataModelAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/ConfigurationDefaultsAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +31 -41
- package/src/main/js/sap/ushell_abap/adapters/abap/FlpLaunchPageAdapter.js +434 -559
- package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionInternalAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/PageBuildingAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationV2Adapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/SearchAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/SupportTicketAdapter.js +4 -4
- package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/UserInfoAdapter.js +119 -125
- package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +27 -33
- package/src/main/js/sap/ushell_abap/base/Ui2Error.js +46 -0
- package/src/main/js/sap/ushell_abap/base/Ui2Utils.js +710 -0
- package/src/main/js/sap/ushell_abap/bootstrap/LoadLaunchpad.js +6 -0
- package/src/main/js/sap/ushell_abap/bootstrap/PageSetsRequestHandler.js +26 -51
- package/src/main/js/sap/ushell_abap/bootstrap/SAPCompanionConditionSetter.js +1 -3
- package/src/main/js/sap/ushell_abap/bootstrap/StartupRequestHandler.js +6 -6
- package/src/main/js/sap/ushell_abap/bootstrap/abapConstants.js +1 -0
- package/src/main/js/sap/ushell_abap/integration/fileshares/NavTargetResolutionFileShareSupport.js +3 -1
- package/src/main/js/sap/ushell_abap/library.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/AllCatalogs.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +71 -45
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +55 -66
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +4 -4
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +5 -37
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +3 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +66 -81
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +14 -17
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +5 -703
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/bag.js +3 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +3 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configurationUi.js +11 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/search.js +3 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/visible.js +1 -1
- package/src/main/js/sap/ushell_abap/services/NavigationDataProvider.js +126 -0
- package/src/main/js/sap/ushell_abap/ui5appruntime/AppInfoAdapter.js +19 -18
- package/ui5.yaml +7 -6
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
sap.ui.define([
|
|
7
7
|
"sap/base/Log",
|
|
8
|
+
"sap/ushell/base/requireAsync",
|
|
8
9
|
"sap/ushell_abap/pbServices/ui2/Bag",
|
|
9
10
|
"sap/ushell_abap/pbServices/ui2/ChipDefinition",
|
|
10
|
-
"sap/ushell_abap/
|
|
11
|
-
"sap/ushell_abap/
|
|
11
|
+
"sap/ushell_abap/base/Ui2Error",
|
|
12
|
+
"sap/ushell_abap/base/Ui2Utils",
|
|
12
13
|
"sap/ushell/utils/DeprecationLog"
|
|
13
14
|
], (
|
|
14
15
|
Log,
|
|
16
|
+
requireAsync,
|
|
15
17
|
Bag,
|
|
16
18
|
ChipDefinition,
|
|
17
19
|
SrvcError,
|
|
@@ -558,21 +560,13 @@ sap.ui.define([
|
|
|
558
560
|
const ComponentContainer = sap.ui.requireSync("sap/ui/core/ComponentContainer"); // LEGACY API (deprecated)
|
|
559
561
|
const oComponentContainer = new ComponentContainer();
|
|
560
562
|
// load the content lazily to enable components using async interface
|
|
561
|
-
this.oComponentPromise =
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
name: oImplementation.componentName,
|
|
567
|
-
componentData: oData,
|
|
568
|
-
manifest: false
|
|
569
|
-
})
|
|
570
|
-
.then((oComponent) => {
|
|
571
|
-
oComponentContainer.setComponent(oComponent);
|
|
572
|
-
})
|
|
573
|
-
.then(resolve)
|
|
574
|
-
.catch(reject);
|
|
563
|
+
this.oComponentPromise = requireAsync(["sap/ui/core/Component"]).then(async ([Component]) => {
|
|
564
|
+
const oComponent = await Component.create({
|
|
565
|
+
name: oImplementation.componentName,
|
|
566
|
+
componentData: oData,
|
|
567
|
+
manifest: false
|
|
575
568
|
});
|
|
569
|
+
oComponentContainer.setComponent(oComponent);
|
|
576
570
|
});
|
|
577
571
|
|
|
578
572
|
return oComponentContainer;
|
|
@@ -602,59 +596,54 @@ sap.ui.define([
|
|
|
602
596
|
this.getImplementationAsSapui5Async = async function (oApi) {
|
|
603
597
|
checkStub();
|
|
604
598
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
if ((sBaseChipId !== "X-SAP-UI2-CHIP:/UI2/STATIC_APPLAUNCHER") && (sBaseChipId !== "X-SAP-UI2-CHIP:/UI2/DYNAMIC_APPLAUNCHER")) {
|
|
625
|
-
if (oImplementation.$VirtualNamespace) {
|
|
626
|
-
oImplementation.$absolutePath = this.toAbsoluteUrl(oImplementation.basePath);
|
|
627
|
-
sap.ui.loader.config({ paths: JSON.parse(`{"${oImplementation.$Namespace.replace(/\./g, "/")}":"${oImplementation.$absolutePath}"}`) });
|
|
628
|
-
} else {
|
|
629
|
-
sap.ui.loader.config({ paths: JSON.parse(`{"${oImplementation.$Namespace.replace(/\./g, "/")}":"${oImplementation.$UrlPrefix}"}`) });
|
|
630
|
-
}
|
|
631
|
-
}
|
|
599
|
+
const [
|
|
600
|
+
ComponentContainer,
|
|
601
|
+
Component,
|
|
602
|
+
View
|
|
603
|
+
] = await requireAsync([
|
|
604
|
+
"sap/ui/core/ComponentContainer",
|
|
605
|
+
"sap/ui/core/Component",
|
|
606
|
+
"sap/ui/core/mvc/View"
|
|
607
|
+
]);
|
|
608
|
+
const oData = {
|
|
609
|
+
/**
|
|
610
|
+
* @namespace
|
|
611
|
+
* The namespace for the instance specific CHIP API, which allows you to
|
|
612
|
+
* access the various contracts consumed by your CHIP instance.
|
|
613
|
+
* @private
|
|
614
|
+
*/
|
|
615
|
+
chip: oApi
|
|
616
|
+
};
|
|
617
|
+
const oImplementation = oDefinition.implementation.sapui5;
|
|
632
618
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
});
|
|
644
|
-
})
|
|
645
|
-
.then(resolve)
|
|
646
|
-
.catch(reject);
|
|
647
|
-
}
|
|
619
|
+
// In case the chip is used in FLP wave 2 or later context we load it from the standard path
|
|
620
|
+
const sBaseChipId = this.getBaseChipId();
|
|
621
|
+
if ((sBaseChipId !== "X-SAP-UI2-CHIP:/UI2/STATIC_APPLAUNCHER") && (sBaseChipId !== "X-SAP-UI2-CHIP:/UI2/DYNAMIC_APPLAUNCHER")) {
|
|
622
|
+
if (oImplementation.$VirtualNamespace) {
|
|
623
|
+
oImplementation.$absolutePath = this.toAbsoluteUrl(oImplementation.basePath);
|
|
624
|
+
sap.ui.loader.config({ paths: JSON.parse(`{"${oImplementation.$Namespace.replace(/\./g, "/")}":"${oImplementation.$absolutePath}"}`) });
|
|
625
|
+
} else {
|
|
626
|
+
sap.ui.loader.config({ paths: JSON.parse(`{"${oImplementation.$Namespace.replace(/\./g, "/")}":"${oImplementation.$UrlPrefix}"}`) });
|
|
627
|
+
}
|
|
628
|
+
}
|
|
648
629
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
630
|
+
if (oImplementation.componentName) {
|
|
631
|
+
// SAPUI5 component
|
|
632
|
+
const oComponent = await Component.create({
|
|
633
|
+
name: oImplementation.componentName,
|
|
634
|
+
componentData: oData,
|
|
635
|
+
manifest: false
|
|
636
|
+
});
|
|
637
|
+
return new ComponentContainer({
|
|
638
|
+
component: oComponent
|
|
657
639
|
});
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// SAPUI5 MVC
|
|
643
|
+
return View.create({
|
|
644
|
+
type: oImplementation.$ViewType,
|
|
645
|
+
viewName: oImplementation.$ViewName,
|
|
646
|
+
viewData: oData
|
|
658
647
|
});
|
|
659
648
|
};
|
|
660
649
|
|
|
@@ -9,8 +9,8 @@ this.sap = this.sap || {};
|
|
|
9
9
|
sap.ui.define([
|
|
10
10
|
"sap/base/Log",
|
|
11
11
|
"sap/ushell_abap/pbServices/ui2/Bag",
|
|
12
|
-
"sap/ushell_abap/
|
|
13
|
-
"sap/ushell_abap/
|
|
12
|
+
"sap/ushell_abap/base/Ui2Error",
|
|
13
|
+
"sap/ushell_abap/base/Ui2Utils",
|
|
14
14
|
"sap/ushell/utils/DeprecationLog"
|
|
15
15
|
], (
|
|
16
16
|
Log,
|
|
@@ -966,7 +966,7 @@ sap.ui.define([
|
|
|
966
966
|
|
|
967
967
|
/**
|
|
968
968
|
* Returns the map of bags for this CHIP instance
|
|
969
|
-
* @returns {sap.ushell_abap.
|
|
969
|
+
* @returns {sap.ushell_abap.base.Ui2Utils.Map} The map of bags
|
|
970
970
|
*
|
|
971
971
|
* @since 1.113.0
|
|
972
972
|
* @private
|
|
@@ -977,7 +977,7 @@ sap.ui.define([
|
|
|
977
977
|
|
|
978
978
|
/**
|
|
979
979
|
* Overwrites the map of bags for this CHIP instance
|
|
980
|
-
* @param {sap.ushell_abap.
|
|
980
|
+
* @param {sap.ushell_abap.base.Ui2Utils.Map} oNewBags The new map of bags
|
|
981
981
|
*
|
|
982
982
|
* @since 1.113.0
|
|
983
983
|
* @private
|
|
@@ -1,44 +1,12 @@
|
|
|
1
1
|
// Copyright (c) 2009-2026 SAP SE, All Rights Reserved
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @fileOverview
|
|
4
|
+
* @fileOverview Deprecated re-export shim. Use "sap/ushell_abap/base/Ui2Error" instead.
|
|
5
|
+
* @deprecated since 1.147.0 - use sap/ushell_abap/base/Ui2Error
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
7
|
sap.ui.define([
|
|
8
|
-
"sap/base/
|
|
9
|
-
], (
|
|
10
|
-
Log
|
|
11
|
-
) => {
|
|
8
|
+
"sap/ushell_abap/base/Ui2Error"
|
|
9
|
+
], (Ui2Error) => {
|
|
12
10
|
"use strict";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Creates an <code>Error</code> object and logs the error message immediately.
|
|
16
|
-
*
|
|
17
|
-
* @param {string} sMessage
|
|
18
|
-
* the error message
|
|
19
|
-
* @param {string} [sComponent]
|
|
20
|
-
* the error component to log
|
|
21
|
-
* @param {boolean} [bLogError=true]
|
|
22
|
-
* defines if the error is logged directly in the constructor; In case the error is going to be catched,
|
|
23
|
-
* the logging may be misleading
|
|
24
|
-
*
|
|
25
|
-
* @class
|
|
26
|
-
* @since 1.2.0
|
|
27
|
-
*/
|
|
28
|
-
function SrvcError (sMessage, sComponent, bLogError) {
|
|
29
|
-
// see also redundant declaration in utils.js which has to be in sync
|
|
30
|
-
const oError = new Error(sMessage); // reuse Error constructor to benefit from it (e.g. stack)
|
|
31
|
-
|
|
32
|
-
// by default the error should be logged (as always in this project)
|
|
33
|
-
bLogError = bLogError === undefined ? true : bLogError;
|
|
34
|
-
|
|
35
|
-
oError.name = "Error";
|
|
36
|
-
if (bLogError === true) {
|
|
37
|
-
Log.error(sMessage, null, sComponent);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return oError;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return SrvcError;
|
|
11
|
+
return Ui2Error;
|
|
44
12
|
});
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
sap.ui.define([
|
|
10
10
|
"sap/ushell_abap/pbServices/ui2/Chip",
|
|
11
|
-
"sap/ushell_abap/
|
|
11
|
+
"sap/ushell_abap/base/Ui2Error",
|
|
12
12
|
"sap/ushell_abap/pbServices/ui2/Catalog",
|
|
13
13
|
"sap/ushell_abap/pbServices/ui2/ChipDefinition",
|
|
14
14
|
"sap/ushell_abap/pbServices/ui2/PageBuildingService",
|
|
15
15
|
"sap/ushell_abap/pbServices/ui2/ChipInstance",
|
|
16
16
|
"sap/ushell_abap/pbServices/ui2/Page",
|
|
17
17
|
"sap/ushell_abap/pbServices/ui2/PageSet",
|
|
18
|
-
"sap/ushell_abap/
|
|
18
|
+
"sap/ushell_abap/base/Ui2Utils",
|
|
19
19
|
"sap/base/Log",
|
|
20
20
|
"sap/base/util/LoaderExtensions"
|
|
21
21
|
], (
|
|
@@ -322,7 +322,7 @@ sap.ui.define([
|
|
|
322
322
|
// cache hit: either array of load handlers, or CHIP definition, or error message
|
|
323
323
|
oChipDefinition = aLoadHandlers = mChipDefinitions[sUrl];
|
|
324
324
|
|
|
325
|
-
if (
|
|
325
|
+
if (Array.isArray(aLoadHandlers)) {
|
|
326
326
|
// wait until loading has finished (one way or the other)
|
|
327
327
|
aLoadHandlers.push(fnSuccess, fnFailure);
|
|
328
328
|
} else if (oChipDefinition instanceof ChipDefinition) {
|
|
@@ -8,11 +8,10 @@ sap.ui.define([
|
|
|
8
8
|
"sap/ui/thirdparty/datajs",
|
|
9
9
|
"sap/base/i18n/Localization",
|
|
10
10
|
"sap/ui/core/Supportability",
|
|
11
|
-
"sap/ushell_abap/
|
|
11
|
+
"sap/ushell_abap/base/Ui2Utils",
|
|
12
12
|
"sap/ushell_abap/pbServices/ui2/ODataService",
|
|
13
|
-
"sap/ushell_abap/
|
|
14
|
-
"sap/base/Log"
|
|
15
|
-
"sap/ui/thirdparty/jquery"
|
|
13
|
+
"sap/ushell_abap/base/Ui2Error",
|
|
14
|
+
"sap/base/Log"
|
|
16
15
|
], (
|
|
17
16
|
datajs,
|
|
18
17
|
Localization,
|
|
@@ -20,26 +19,23 @@ sap.ui.define([
|
|
|
20
19
|
Utils,
|
|
21
20
|
ODataService,
|
|
22
21
|
SrvcError,
|
|
23
|
-
Log
|
|
24
|
-
jQuery
|
|
22
|
+
Log
|
|
25
23
|
) => {
|
|
26
24
|
"use strict";
|
|
27
25
|
|
|
28
|
-
/* global OData */
|
|
29
|
-
|
|
30
26
|
function nop () { /* null object pattern */ }
|
|
31
27
|
/**
|
|
32
|
-
* Reject the given
|
|
28
|
+
* Reject the given Deferred object(s) (array or single one) with the
|
|
33
29
|
* given error response.
|
|
34
30
|
*
|
|
35
|
-
* @param {
|
|
31
|
+
* @param {object|object[]} vDeferred
|
|
36
32
|
* deferred or array of deferreds to be rejected
|
|
37
33
|
* @param {object} oResponse
|
|
38
34
|
* parameter of (each) reject call
|
|
39
35
|
*/
|
|
40
36
|
function reject (vDeferred, oResponse) {
|
|
41
|
-
if (
|
|
42
|
-
// a failed change set: reject each single
|
|
37
|
+
if (Array.isArray(vDeferred)) {
|
|
38
|
+
// a failed change set: reject each single Deferred in the same way
|
|
43
39
|
vDeferred.forEach((oDeferred) => {
|
|
44
40
|
oDeferred.reject(oResponse);
|
|
45
41
|
});
|
|
@@ -355,7 +351,7 @@ sap.ui.define([
|
|
|
355
351
|
addGlobalSapHeaders(oHeaders);
|
|
356
352
|
addStickySessionHeader(oHeaders);
|
|
357
353
|
|
|
358
|
-
|
|
354
|
+
datajs.request({
|
|
359
355
|
requestUri: sRequestUrl,
|
|
360
356
|
method: sMethod,
|
|
361
357
|
data: oPayload,
|
|
@@ -363,9 +359,7 @@ sap.ui.define([
|
|
|
363
359
|
},
|
|
364
360
|
(oData, oResponse) => {
|
|
365
361
|
this.detectStickySession((oResponse || {}).headers);
|
|
366
|
-
Log.debug(`Received OData response for ${sMethod} "${sRequestUrl}"`,
|
|
367
|
-
null,
|
|
368
|
-
"ODataWrapper");
|
|
362
|
+
Log.debug(`Received OData response for ${sMethod} "${sRequestUrl}"`, null, "ODataWrapper");
|
|
369
363
|
// Note: drop excess parameters; try/catch
|
|
370
364
|
Utils.callHandler(fnSuccess.bind(null, oData), fnFailure);
|
|
371
365
|
},
|
|
@@ -382,9 +376,7 @@ sap.ui.define([
|
|
|
382
376
|
&& oError.response.statusCode === 403
|
|
383
377
|
&& ODataWrapper.csrfTokenValue(oError.response.headers).toLowerCase() === "required") {
|
|
384
378
|
// refresh CSRF token and repeat original request
|
|
385
|
-
Log.debug(`CSRF token required for ${sMethod} "${sRequestUrl
|
|
386
|
-
}", refreshing it`, JSON.stringify(oError.response),
|
|
387
|
-
"ODataWrapper");
|
|
379
|
+
Log.debug(`CSRF token required for ${sMethod} "${sRequestUrl}", refreshing it`, JSON.stringify(oError.response), "ODataWrapper");
|
|
388
380
|
|
|
389
381
|
oODataService.refreshCsrfToken(
|
|
390
382
|
this.doRequest.bind(that, sRequestUrl, sMethod, oPayload, success, failure, oHandler, /* bIsRepeatedRequest */ true),
|
|
@@ -395,8 +387,7 @@ sap.ui.define([
|
|
|
395
387
|
}
|
|
396
388
|
},
|
|
397
389
|
oHandler);
|
|
398
|
-
Log.debug(`Sent OData request for ${sMethod} "${sRequestUrl}"`, null,
|
|
399
|
-
"ODataWrapper");
|
|
390
|
+
Log.debug(`Sent OData request for ${sMethod} "${sRequestUrl}"`, null, "ODataWrapper");
|
|
400
391
|
};
|
|
401
392
|
|
|
402
393
|
/**
|
|
@@ -414,8 +405,7 @@ sap.ui.define([
|
|
|
414
405
|
this.toRelativeUrl = function (sRequestUrl) {
|
|
415
406
|
const i = sRequestUrl.indexOf(sBaseUrl);
|
|
416
407
|
if (i < 0) {
|
|
417
|
-
throw new SrvcError(`Not relative to base URL "${sBaseUrl}": ${sRequestUrl}`,
|
|
418
|
-
"ODataWrapper");
|
|
408
|
+
throw new SrvcError(`Not relative to base URL "${sBaseUrl}": ${sRequestUrl}`, "ODataWrapper");
|
|
419
409
|
}
|
|
420
410
|
return sRequestUrl.slice(i + sBaseUrl.length);
|
|
421
411
|
};
|
|
@@ -432,8 +422,7 @@ sap.ui.define([
|
|
|
432
422
|
*/
|
|
433
423
|
this.toRequestUrl = function (sRelativeUrl) {
|
|
434
424
|
if (/^\//.test(sRelativeUrl)) {
|
|
435
|
-
throw new SrvcError(`Not a relative URL: ${sRelativeUrl}`,
|
|
436
|
-
"ODataWrapper");
|
|
425
|
+
throw new SrvcError(`Not a relative URL: ${sRelativeUrl}`, "ODataWrapper");
|
|
437
426
|
}
|
|
438
427
|
return sBaseUrl + sRelativeUrl;
|
|
439
428
|
};
|
|
@@ -460,20 +449,22 @@ sap.ui.define([
|
|
|
460
449
|
// if sRelativeUrl is empty, we ask for the service document, which is only used for fetching an XSRF token,
|
|
461
450
|
// so we are not taking already queued requests into account.
|
|
462
451
|
if (aBatchQueue && sRelativeUrl !== "") {
|
|
463
|
-
Log.debug(`Queued OData request for GET "${sRelativeUrl}"`, null,
|
|
464
|
-
"ODataWrapper");
|
|
452
|
+
Log.debug(`Queued OData request for GET "${sRelativeUrl}"`, null, "ODataWrapper");
|
|
465
453
|
aBatchQueue.push({
|
|
466
454
|
method: "GET",
|
|
467
455
|
requestUri: sRelativeUrl,
|
|
468
456
|
headers: oHeaders
|
|
469
457
|
});
|
|
470
|
-
oDeferred =
|
|
458
|
+
oDeferred = Promise.withResolvers();
|
|
459
|
+
oDeferred.promise
|
|
460
|
+
.then(([oData, oResponse]) => fnRawSuccess(oData, oResponse))
|
|
461
|
+
.catch(fnRawFailure);
|
|
471
462
|
aDeferredQueue.push(oDeferred);
|
|
472
463
|
bChangeSetOpen = false;
|
|
473
464
|
return;
|
|
474
465
|
}
|
|
475
466
|
|
|
476
|
-
// add
|
|
467
|
+
// add specific headers for read request
|
|
477
468
|
oHeaders.Accept = "application/json";
|
|
478
469
|
oHeaders["Accept-Language"] = Localization.getLanguage() || "";
|
|
479
470
|
// always fetch a new token with GET requests;
|
|
@@ -481,12 +472,11 @@ sap.ui.define([
|
|
|
481
472
|
// see internal BCP incident 1570753380
|
|
482
473
|
oHeaders["X-CSRF-Token"] = "Fetch";
|
|
483
474
|
|
|
484
|
-
|
|
475
|
+
datajs.read({
|
|
485
476
|
requestUri: sRequestUrl,
|
|
486
477
|
headers: oHeaders
|
|
487
478
|
}, fnRawSuccess, fnRawFailure);
|
|
488
|
-
Log.debug(`Sent OData request for GET "${sRequestUrl}"`, null,
|
|
489
|
-
"ODataWrapper");
|
|
479
|
+
Log.debug(`Sent OData request for GET "${sRequestUrl}"`, null, "ODataWrapper");
|
|
490
480
|
};
|
|
491
481
|
|
|
492
482
|
/**
|
|
@@ -532,14 +522,15 @@ sap.ui.define([
|
|
|
532
522
|
bChangeSetOpen = bSupportsChangeSets;
|
|
533
523
|
}
|
|
534
524
|
aBatchQueue[aBatchQueue.length - 1].__changeRequests.push(oChangeRequest);
|
|
535
|
-
oDeferred =
|
|
536
|
-
|
|
525
|
+
oDeferred = Promise.withResolvers();
|
|
526
|
+
oDeferred.promise
|
|
527
|
+
.then(([oData]) => {
|
|
537
528
|
Log.debug(`Received OData response for ${
|
|
538
529
|
sMethod} "${sRequestUrl}"`, null, "ODataWrapper");
|
|
539
530
|
// Note: drop excess parameters; try/catch
|
|
540
531
|
Utils.callHandler(fnSuccess.bind(null, oData), fnFailure);
|
|
541
532
|
})
|
|
542
|
-
.
|
|
533
|
+
.catch(that.onError.bind(that, sMethod, sRequestUrl, fnFailure, /* oDeferred */null));
|
|
543
534
|
aDeferredQueue[aDeferredQueue.length - 1].push(oDeferred);
|
|
544
535
|
return;
|
|
545
536
|
}
|
|
@@ -628,20 +619,16 @@ sap.ui.define([
|
|
|
628
619
|
*/
|
|
629
620
|
this.check = function (fnSuccess, fnFailure) {
|
|
630
621
|
if (!fnSuccess) {
|
|
631
|
-
throw new SrvcError("Missing success callback",
|
|
632
|
-
"ODataWrapper");
|
|
622
|
+
throw new SrvcError("Missing success callback", "ODataWrapper");
|
|
633
623
|
}
|
|
634
624
|
if (typeof fnSuccess !== "function") {
|
|
635
|
-
throw new SrvcError("Success callback is not a function",
|
|
636
|
-
"ODataWrapper");
|
|
625
|
+
throw new SrvcError("Success callback is not a function", "ODataWrapper");
|
|
637
626
|
}
|
|
638
627
|
if (!fnFailure) {
|
|
639
|
-
throw new SrvcError("Missing error callback",
|
|
640
|
-
"ODataWrapper");
|
|
628
|
+
throw new SrvcError("Missing error callback", "ODataWrapper");
|
|
641
629
|
}
|
|
642
630
|
if (typeof fnFailure !== "function") {
|
|
643
|
-
throw new SrvcError("Error callback is not a function",
|
|
644
|
-
"ODataWrapper");
|
|
631
|
+
throw new SrvcError("Error callback is not a function", "ODataWrapper");
|
|
645
632
|
}
|
|
646
633
|
};
|
|
647
634
|
|
|
@@ -771,9 +758,7 @@ sap.ui.define([
|
|
|
771
758
|
* cannot be parsed or is not returned in the OData error response.<br />
|
|
772
759
|
*
|
|
773
760
|
* <b>NOTE:</b> the second parameter is returned since version 1.28.6.
|
|
774
|
-
* @param {
|
|
775
|
-
* a <code>jQuery.Deferred</code> object that will be rejected with the
|
|
776
|
-
* same arguments fnFailure is called
|
|
761
|
+
* @param {object} [oDeferred] Deferred object from Promise.withResolvers
|
|
777
762
|
* @param {object} oError
|
|
778
763
|
* error object provided by datajs, should contain the response
|
|
779
764
|
*
|
|
@@ -814,8 +799,9 @@ sap.ui.define([
|
|
|
814
799
|
Log.error(sMessage, JSON.stringify(oError.response), "ODataWrapper");
|
|
815
800
|
|
|
816
801
|
if (oDeferred) {
|
|
817
|
-
// reject with
|
|
818
|
-
|
|
802
|
+
// reject with a tuple as native promises settle with a single value;
|
|
803
|
+
// the message is later forwarded to fnFailure (see the cache-hit consumer)
|
|
804
|
+
oDeferred.reject([sMessage, oParsedErrorInformation]);
|
|
819
805
|
}
|
|
820
806
|
fnFailure(sMessage, oParsedErrorInformation);
|
|
821
807
|
};
|
|
@@ -896,19 +882,19 @@ sap.ui.define([
|
|
|
896
882
|
oODataService.setCsrfToken(
|
|
897
883
|
ODataWrapper.csrfTokenValue(oResponse.headers) || oODataService.getCsrfToken() // prefer a new token
|
|
898
884
|
);
|
|
899
|
-
Log.debug(`Received OData response for GET "${sRequestUrl}"`, null,
|
|
900
|
-
"ODataWrapper");
|
|
885
|
+
Log.debug(`Received OData response for GET "${sRequestUrl}"`, null, "ODataWrapper");
|
|
901
886
|
// The sap-message header is a Gateway feature used e.g. by the INTEROP service
|
|
902
887
|
// It returns structured information (as XML). We don't evaluate it, we only log it.
|
|
903
888
|
// Severity is also part of the structure, but we simply assume warning.
|
|
904
889
|
sSapMessage = ODataWrapper.headerValue("sap-message", oResponse.headers);
|
|
905
890
|
if (sSapMessage) {
|
|
906
|
-
Log.warning(`SAP message for GET ${sRequestUrl}`, sSapMessage,
|
|
907
|
-
"ODataWrapper");
|
|
891
|
+
Log.warning(`SAP message for GET ${sRequestUrl}`, sSapMessage, "ODataWrapper");
|
|
908
892
|
}
|
|
909
893
|
if (oDeferred) {
|
|
910
894
|
// put arguments for fnSuccess into cache; clone oData first
|
|
911
|
-
|
|
895
|
+
// Note: native promises settle with a single value, so multiple
|
|
896
|
+
// values are forwarded as a tuple (see the cache-hit consumer below)
|
|
897
|
+
oDeferred.resolve([JSON.parse(JSON.stringify(oData)), oODataService.getCsrfToken()]);
|
|
912
898
|
}
|
|
913
899
|
// Note: drop excess parameters; try/catch
|
|
914
900
|
Utils.callHandler(fnSuccess.bind(null, oData), fnFailure);
|
|
@@ -918,22 +904,23 @@ sap.ui.define([
|
|
|
918
904
|
this.check(fnSuccess, fnFailure);
|
|
919
905
|
|
|
920
906
|
if (bCache) {
|
|
921
|
-
|
|
922
|
-
oDeferred =
|
|
907
|
+
datajs.read.$cache = datajs.read.$cache || new Utils.Map();
|
|
908
|
+
oDeferred = datajs.read.$cache.get(sRequestUrl); // the (native) promise is cached
|
|
923
909
|
if (oDeferred) {
|
|
924
|
-
Log.debug(`Using cached response for GET "${sRequestUrl}"`, null,
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
910
|
+
Log.debug(`Using cached response for GET "${sRequestUrl}"`, null, "ODataWrapper");
|
|
911
|
+
oDeferred
|
|
912
|
+
.then(([oData, sCachedCsrfToken]) => {
|
|
913
|
+
// prefer our own token
|
|
914
|
+
oODataService.setCsrfToken(oODataService.getCsrfToken() || sCachedCsrfToken);
|
|
915
|
+
// clone cached oData before passing to success handler
|
|
916
|
+
// Note: try/catch
|
|
917
|
+
Utils.callHandler(fnSuccess.bind(null, JSON.parse(JSON.stringify(oData))), fnFailure);
|
|
918
|
+
})
|
|
919
|
+
.catch(([sMessage, oError]) => fnFailure(sMessage, oError));
|
|
933
920
|
return;
|
|
934
921
|
}
|
|
935
|
-
oDeferred =
|
|
936
|
-
|
|
922
|
+
oDeferred = Promise.withResolvers();
|
|
923
|
+
datajs.read.$cache.put(sRequestUrl, oDeferred.promise);
|
|
937
924
|
}
|
|
938
925
|
|
|
939
926
|
this.readOrBatch(
|
|
@@ -963,7 +950,7 @@ sap.ui.define([
|
|
|
963
950
|
this.batch = function (oPayload, fnSuccess, fnFailure) {
|
|
964
951
|
const sRequestUrl = this.toRequestUrl("$batch");
|
|
965
952
|
|
|
966
|
-
this.doRequest(sRequestUrl, "POST", oPayload, fnSuccess, fnFailure,
|
|
953
|
+
this.doRequest(sRequestUrl, "POST", oPayload, fnSuccess, fnFailure, datajs.batchHandler);
|
|
967
954
|
};
|
|
968
955
|
|
|
969
956
|
/**
|
|
@@ -1006,10 +993,13 @@ sap.ui.define([
|
|
|
1006
993
|
const iExpected = aMyDeferredQueue.length;
|
|
1007
994
|
|
|
1008
995
|
if (iExpected !== iActual) {
|
|
1009
|
-
that.onError(
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
996
|
+
that.onError(
|
|
997
|
+
"POST",
|
|
998
|
+
this.toRequestUrl("$batch"),
|
|
999
|
+
fnBatchItselfFailed,
|
|
1000
|
+
/* oDeferred */null,
|
|
1001
|
+
{message: `Protocol error! Expected ${iExpected} responses, but received ${iActual}`}
|
|
1002
|
+
);
|
|
1013
1003
|
return;
|
|
1014
1004
|
}
|
|
1015
1005
|
|
|
@@ -1022,11 +1012,11 @@ sap.ui.define([
|
|
|
1022
1012
|
} else if (oResponse.__changeResponses) {
|
|
1023
1013
|
// successful change set
|
|
1024
1014
|
oResponse.__changeResponses.forEach((oChangeResponse, j) => {
|
|
1025
|
-
oDeferred[j].resolve(oChangeResponse.data, oChangeResponse);
|
|
1015
|
+
oDeferred[j].resolve([oChangeResponse.data, oChangeResponse]);
|
|
1026
1016
|
});
|
|
1027
1017
|
} else {
|
|
1028
1018
|
// successful GET request
|
|
1029
|
-
oDeferred.resolve(oResponse.data, oResponse);
|
|
1019
|
+
oDeferred.resolve([oResponse.data, oResponse]);
|
|
1030
1020
|
}
|
|
1031
1021
|
});
|
|
1032
1022
|
|
|
@@ -1040,7 +1030,7 @@ sap.ui.define([
|
|
|
1040
1030
|
}
|
|
1041
1031
|
|
|
1042
1032
|
if (aBatchQueue.length > 0) {
|
|
1043
|
-
Log.debug("[000] submit batch queue: batch", "
|
|
1033
|
+
Log.debug("[000] submit batch queue: batch", "ODataWrapper");
|
|
1044
1034
|
this.batch({ __batchRequests: aBatchQueue }, onBatchSuccess.bind(this), fnBatchItselfFailed);
|
|
1045
1035
|
} else if (fnBatchAccepted) {
|
|
1046
1036
|
// call success handler (if given) directly (async) if batchQueue is empty
|
|
@@ -1065,8 +1055,6 @@ sap.ui.define([
|
|
|
1065
1055
|
*/
|
|
1066
1056
|
this.toString = function (bVerbose) {
|
|
1067
1057
|
const aResult = ['ODataWrapper({sBaseUrl:"', sBaseUrl, '"'];
|
|
1068
|
-
// if (bVerbose) {
|
|
1069
|
-
// }
|
|
1070
1058
|
aResult.push("})");
|
|
1071
1059
|
return aResult.join("");
|
|
1072
1060
|
};
|
|
@@ -1155,9 +1143,7 @@ sap.ui.define([
|
|
|
1155
1143
|
bSupportsChangeSets = oSettings.supportsChangeSets;
|
|
1156
1144
|
|
|
1157
1145
|
if (typeof ODataWrapper.oStickySessionConfiguration === "undefined") {
|
|
1158
|
-
Log.error("ODataWrapper.oStickySessionConfiguration is not defined!",
|
|
1159
|
-
"the ODataWrapper constructor was called before the static property was defined",
|
|
1160
|
-
"ODataWrapper");
|
|
1146
|
+
Log.error("ODataWrapper.oStickySessionConfiguration is not defined!", "the ODataWrapper constructor was called before the static property was defined", "ODataWrapper");
|
|
1161
1147
|
} else if (typeof ODataWrapper.oStickySessionConfiguration[sBaseUrl] === "undefined") {
|
|
1162
1148
|
// Define the sticky session configuration for the base URL managed by
|
|
1163
1149
|
// this ODataWrapper instance.
|
|
@@ -1220,8 +1206,7 @@ sap.ui.define([
|
|
|
1220
1206
|
ODataWrapper["sap-statistics"] = Supportability.isStatisticsEnabled();
|
|
1221
1207
|
} catch {
|
|
1222
1208
|
// Read sap-statistics directly form query parameter in scenarios without UI5
|
|
1223
|
-
ODataWrapper["sap-statistics"] =
|
|
1224
|
-
/sap-statistics=(true|x|X)/.test(sWindowLocationSearch);
|
|
1209
|
+
ODataWrapper["sap-statistics"] = /sap-statistics=(true|x|X)/.test(sWindowLocationSearch);
|
|
1225
1210
|
}
|
|
1226
1211
|
};
|
|
1227
1212
|
ODataWrapper.checkSapStatisticsSetting(window.location.search);
|