@salesforce/lds-adapters-uiapi-lex 1.364.0 → 1.366.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 +96 -174
package/package.json
CHANGED
@@ -14,206 +14,128 @@
|
|
14
14
|
/* proxy-compat-disable */
|
15
15
|
import { CommandWireAdapterConstructor } from 'force/luvioLwcBindings5';
|
16
16
|
|
17
|
-
|
17
|
+
/*!
|
18
18
|
* Copyright (c) 2022, Salesforce, Inc.,
|
19
19
|
* All rights reserved.
|
20
20
|
* For full license text, see the LICENSE.txt file
|
21
21
|
*/
|
22
|
-
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Returns a PromiseLike object that resolves with the specified result.
|
26
|
-
*
|
27
|
-
* @param result resolved result
|
28
|
-
* @returns
|
29
|
-
*/
|
30
22
|
function resolvedPromiseLike$1(result) {
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
if (isPromiseLike$1(result)) {
|
24
|
+
return result.then((nextResult) => nextResult);
|
25
|
+
}
|
26
|
+
return {
|
27
|
+
then: (onFulfilled, _onRejected) => {
|
28
|
+
try {
|
29
|
+
return resolvedPromiseLike$1(onFulfilled(result));
|
30
|
+
} catch (e) {
|
31
|
+
if (onFulfilled === void 0) {
|
32
|
+
return resolvedPromiseLike$1(result);
|
33
|
+
}
|
34
|
+
return rejectedPromiseLike$1(e);
|
35
|
+
}
|
34
36
|
}
|
35
|
-
|
36
|
-
then: (onFulfilled, _onRejected) => {
|
37
|
-
if (typeof onFulfilled === 'function') {
|
38
|
-
try {
|
39
|
-
return resolvedPromiseLike$1(onFulfilled(result));
|
40
|
-
}
|
41
|
-
catch (e) {
|
42
|
-
return rejectedPromiseLike$1(e);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
// assume TResult1 == Result and just pass result down the chain
|
46
|
-
return resolvedPromiseLike$1(result);
|
47
|
-
},
|
48
|
-
};
|
37
|
+
};
|
49
38
|
}
|
50
|
-
/**
|
51
|
-
* Returns a PromiseLike object that rejects with the specified reason.
|
52
|
-
*
|
53
|
-
* @param reason rejection value
|
54
|
-
* @returns PromiseLike that rejects with reason
|
55
|
-
*/
|
56
39
|
function rejectedPromiseLike$1(reason) {
|
57
|
-
|
58
|
-
|
40
|
+
if (isPromiseLike$1(reason)) {
|
41
|
+
return reason.then((nextResult) => nextResult);
|
42
|
+
}
|
43
|
+
return {
|
44
|
+
then: (_onFulfilled, onRejected) => {
|
45
|
+
if (typeof onRejected === "function") {
|
46
|
+
try {
|
47
|
+
return resolvedPromiseLike$1(onRejected(reason));
|
48
|
+
} catch (e) {
|
49
|
+
return rejectedPromiseLike$1(e);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
return rejectedPromiseLike$1(reason);
|
59
53
|
}
|
60
|
-
|
61
|
-
then: (_onFulfilled, onRejected) => {
|
62
|
-
if (typeof onRejected === 'function') {
|
63
|
-
try {
|
64
|
-
return resolvedPromiseLike$1(onRejected(reason));
|
65
|
-
}
|
66
|
-
catch (e) {
|
67
|
-
return rejectedPromiseLike$1(e);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
// assume TResult2 == Result and just pass rejection down the chain
|
71
|
-
return rejectedPromiseLike$1(reason);
|
72
|
-
},
|
73
|
-
};
|
54
|
+
};
|
74
55
|
}
|
75
|
-
/**
|
76
|
-
* Indicates if an object is PromiseLike.
|
77
|
-
*
|
78
|
-
* @param x anything
|
79
|
-
* @returns true if x is PromiseLike; false if not
|
80
|
-
*/
|
81
56
|
function isPromiseLike$1(x) {
|
82
|
-
|
57
|
+
return typeof (x == null ? void 0 : x.then) === "function";
|
83
58
|
}
|
84
|
-
/**
|
85
|
-
* As Promise.race, but returns sychronously if any of the supplied values resolve/reject
|
86
|
-
* synchronously.
|
87
|
-
*
|
88
|
-
* @param values as Promise.race
|
89
|
-
* @returns as Promise.race
|
90
|
-
*/
|
91
59
|
function racesync$1(values) {
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
else {
|
102
|
-
settled = resolvedPromiseLike$1(value);
|
103
|
-
}
|
104
|
-
if (settled !== undefined) {
|
105
|
-
return settled;
|
60
|
+
for (const value of values) {
|
61
|
+
let settled = void 0;
|
62
|
+
if (isPromiseLike$1(value)) {
|
63
|
+
value.then(
|
64
|
+
(_) => {
|
65
|
+
settled = value;
|
66
|
+
},
|
67
|
+
(_) => {
|
68
|
+
settled = value;
|
106
69
|
}
|
70
|
+
);
|
71
|
+
} else {
|
72
|
+
settled = resolvedPromiseLike$1(value);
|
107
73
|
}
|
108
|
-
|
74
|
+
if (settled !== void 0) {
|
75
|
+
return settled;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
return Promise.race(values);
|
109
79
|
}
|
110
|
-
|
111
|
-
/**
|
112
|
-
* Indicates if a given instance of a service satisfies a request. Note that this function
|
113
|
-
* assumes the version numbers are valid strings.
|
114
|
-
*
|
115
|
-
* @param provided ServiceVersion of the service instance to be provided
|
116
|
-
* @param requested ServiceVersion requested
|
117
|
-
* @returns true if the service instance to be provided satisfies the request
|
118
|
-
*/
|
119
80
|
function satisfies(provided, requested) {
|
120
|
-
|
121
|
-
|
122
|
-
|
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];
|
123
84
|
}
|
124
85
|
|
125
|
-
|
126
|
-
(function (HttpStatusCode) {
|
127
|
-
HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
|
128
|
-
HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
|
129
|
-
HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
|
130
|
-
HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
|
131
|
-
HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
|
132
|
-
HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
|
133
|
-
HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
|
134
|
-
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
|
135
|
-
HttpStatusCode[HttpStatusCode["ServerError"] = 500] = "ServerError";
|
136
|
-
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
|
137
|
-
})(HttpStatusCode || (HttpStatusCode = {}));
|
138
|
-
|
139
|
-
/**
|
86
|
+
/*!
|
140
87
|
* Copyright (c) 2022, Salesforce, Inc.,
|
141
88
|
* All rights reserved.
|
142
89
|
* For full license text, see the LICENSE.txt file
|
143
90
|
*/
|
144
|
-
|
145
|
-
|
146
|
-
/**
|
147
|
-
* Attempts to resolve a set of requested services against a set of published services.
|
148
|
-
* Returns a map of the requested services if the published services satisfy the request;
|
149
|
-
* undefined if published services are missing one or more of the requested services.
|
150
|
-
*
|
151
|
-
* Note that this function is exported ONLY for use by runtime environments that need to
|
152
|
-
* override the default getServices() implementation below. Service consumers should only
|
153
|
-
* use the default export to request the services they need.
|
154
|
-
*
|
155
|
-
* @param published published services
|
156
|
-
* @param requested requested services
|
157
|
-
* @returns service map if published satisfies requests; undefined if not
|
158
|
-
*/
|
159
91
|
function resolve(published, requested) {
|
160
|
-
|
161
|
-
|
162
|
-
|
92
|
+
const result = {};
|
93
|
+
for (const [name, request] of Object.entries(requested)) {
|
94
|
+
const matchingService = published.find(
|
95
|
+
(s) => (
|
163
96
|
// service types must match
|
164
|
-
s.type === request.type &&
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
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;
|
176
109
|
}
|
177
|
-
|
110
|
+
}
|
111
|
+
return result;
|
178
112
|
}
|
179
|
-
let waitForServices = new Promise(
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
}
|
204
|
-
|
205
|
-
let timeoutPromise = new Promise((_, reject) => {
|
206
|
-
timeoutId = setTimeout(() => reject(new Error('OneStore services unavailable')), timeout);
|
207
|
-
});
|
208
|
-
return racesync$1([servicesPromise, timeoutPromise]).then((value) => {
|
209
|
-
clearTimeout(timeoutId);
|
210
|
-
return value;
|
211
|
-
}, (reason) => {
|
212
|
-
clearTimeout(timeoutId);
|
213
|
-
// eslint-disable-next-line
|
214
|
-
console.error(reason);
|
215
|
-
throw reason;
|
216
|
-
});
|
113
|
+
let waitForServices = new Promise(
|
114
|
+
(resolve2) => resolve2
|
115
|
+
);
|
116
|
+
function getServices(request, timeout = 3e4) {
|
117
|
+
const servicesPromise = waitForServices.then((services) => {
|
118
|
+
const result = resolve(services, request);
|
119
|
+
if (result) {
|
120
|
+
return result;
|
121
|
+
}
|
122
|
+
throw new Error("no matches found for one or more requested services");
|
123
|
+
});
|
124
|
+
let timeoutId;
|
125
|
+
let timeoutPromise = new Promise((_, reject) => {
|
126
|
+
timeoutId = setTimeout(() => reject(new Error("OneStore services unavailable")), timeout);
|
127
|
+
});
|
128
|
+
return racesync$1([servicesPromise, timeoutPromise]).then(
|
129
|
+
(value) => {
|
130
|
+
clearTimeout(timeoutId);
|
131
|
+
return value;
|
132
|
+
},
|
133
|
+
(reason) => {
|
134
|
+
clearTimeout(timeoutId);
|
135
|
+
console.error(reason);
|
136
|
+
throw reason;
|
137
|
+
}
|
138
|
+
);
|
217
139
|
}
|
218
140
|
|
219
141
|
/**
|
@@ -665,4 +587,4 @@ racesync([getServices(serviceRequirements)]).then(
|
|
665
587
|
);
|
666
588
|
|
667
589
|
export { getObjectInfo, getObjectInfos };
|
668
|
-
// version: 1.
|
590
|
+
// version: 1.366.0-30380c7ed7
|