@salesforce/lds-adapters-uiapi-lex 1.412.0 → 1.413.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/sfdc/ldsAdaptersUiapiLex.js +13 -36
package/package.json
CHANGED
|
@@ -77,50 +77,27 @@ function racesync(values) {
|
|
|
77
77
|
}
|
|
78
78
|
return Promise.race(values);
|
|
79
79
|
}
|
|
80
|
-
function satisfies(provided, requested) {
|
|
81
|
-
const providedN = provided.split(".").map((s) => parseInt(s));
|
|
82
|
-
const requestedN = requested.split(".").map((s) => parseInt(s));
|
|
83
|
-
return providedN[0] === requestedN[0] && providedN[1] >= requestedN[1];
|
|
84
|
-
}
|
|
85
80
|
|
|
86
81
|
/*!
|
|
87
82
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
88
83
|
* All rights reserved.
|
|
89
84
|
* For full license text, see the LICENSE.txt file
|
|
90
85
|
*/
|
|
91
|
-
|
|
92
|
-
const result = {};
|
|
93
|
-
for (const [name, request] of Object.entries(requested)) {
|
|
94
|
-
const matchingService = published.find(
|
|
95
|
-
(s) => (
|
|
96
|
-
// service types must match
|
|
97
|
-
s.type === request.type && // version of the service must satisfy the requested version
|
|
98
|
-
satisfies(s.version, request.version) && // no tags requested, or the service matches every requested tag value
|
|
99
|
-
(request.tags === void 0 || Object.keys(request.tags).every((tag) => {
|
|
100
|
-
var _a;
|
|
101
|
-
return ((_a = s.tags) == null ? void 0 : _a[tag]) === request.tags[tag];
|
|
102
|
-
}))
|
|
103
|
-
)
|
|
104
|
-
);
|
|
105
|
-
if (matchingService) {
|
|
106
|
-
result[name] = matchingService.service;
|
|
107
|
-
} else if (!("optional" in request && request.optional)) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return result;
|
|
112
|
-
}
|
|
113
|
-
let waitForServices = new Promise(
|
|
86
|
+
let waitForResolver = new Promise(
|
|
114
87
|
(resolve2) => resolve2
|
|
115
88
|
);
|
|
116
89
|
function getServices(request, timeout = 3e4) {
|
|
117
|
-
const servicesPromise =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
90
|
+
const servicesPromise = waitForResolver.then(
|
|
91
|
+
(resolver) => (
|
|
92
|
+
// try to resolve the requested services against our services
|
|
93
|
+
resolver(request).then(([resolved, unresolved]) => {
|
|
94
|
+
if (unresolved.length === 0) {
|
|
95
|
+
return resolved;
|
|
96
|
+
}
|
|
97
|
+
throw new Error("no matches found for one or more requested services");
|
|
98
|
+
})
|
|
99
|
+
)
|
|
100
|
+
);
|
|
124
101
|
let timeoutId;
|
|
125
102
|
let timeoutPromise = new Promise((_, reject) => {
|
|
126
103
|
timeoutId = setTimeout(() => reject(new Error("OneStore services unavailable")), timeout);
|
|
@@ -493,4 +470,4 @@ racesync([getServices(serviceRequirements)]).then(
|
|
|
493
470
|
);
|
|
494
471
|
|
|
495
472
|
export { getObjectInfo, getObjectInfos };
|
|
496
|
-
// version: 1.
|
|
473
|
+
// version: 1.413.0-a073c11951
|