@salesforce/lds-runtime-aura 1.332.0-dev3 → 1.333.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/dist/ldsEngineCreator.js +261 -32
- package/dist/types/__mocks__/@salesforce/lds-network-fetch.d.ts +2 -0
- package/dist/types/network-fetch.d.ts +1 -2
- package/dist/types/network-sfap.d.ts +2 -12
- package/package.json +27 -27
- package/dist/types/__mocks__/@salesforce/lds-network-fetch-with-jwt.d.ts +0 -3
package/dist/ldsEngineCreator.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* *******************************************************************************************
|
|
13
13
|
*/
|
|
14
14
|
/* proxy-compat-disable */
|
|
15
|
-
import { HttpStatusCode as HttpStatusCode$
|
|
15
|
+
import { HttpStatusCode as HttpStatusCode$3, InMemoryStore, Environment, Luvio, InMemoryStoreQueryEvaluator } from 'force/luvioEngine';
|
|
16
16
|
import ldsTrackedFieldsBehaviorGate from '@salesforce/gate/lds.useNewTrackedFieldBehavior';
|
|
17
17
|
import usePredictiveLoading from '@salesforce/gate/lds.usePredictiveLoading';
|
|
18
18
|
import useApexPredictions from '@salesforce/gate/lds.pdl.useApexPredictions';
|
|
@@ -26,11 +26,11 @@ import { setServices } from 'force/luvioServiceProvisioner1';
|
|
|
26
26
|
import oneStoreEnabled from '@salesforce/gate/lds.oneStoreEnabled.ltng';
|
|
27
27
|
import oneStoreUiapiEnabled from '@salesforce/gate/lds.oneStoreUiapiEnabled.ltng';
|
|
28
28
|
import { unstable_loadComponentDefs, executeGlobalControllerRawResponse } from 'aura';
|
|
29
|
-
import { buildJwtNetworkAdapter, instrument as instrument$2, setupLexJwtNetworkAdapter } from 'force/ldsNetworkFetchWithJwt';
|
|
30
29
|
import auraNetworkAdapter, { dispatchAuraAction, defaultActionConfig, instrument as instrument$1, forceRecordTransactionsDisabled as forceRecordTransactionsDisabled$1, ldsNetworkAdapterInstrument, CrudEventState, CrudEventType, UIAPI_RECORDS_PATH, UIAPI_RELATED_LIST_RECORDS_BATCH_PATH, UIAPI_RELATED_LIST_RECORDS_PATH } from 'force/ldsNetwork';
|
|
31
30
|
import { LRUCache, instrumentAdapter, instrumentLuvio, setupInstrumentation as setupInstrumentation$1, logObjectInfoChanged as logObjectInfoChanged$1, updatePercentileHistogramMetric, incrementCounterMetric, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, setLdsAdaptersUiapiInstrumentation, logError, setLdsNetworkAdapterInstrumentation, executeAsyncActivity, METRIC_KEYS, onIdleDetected } from 'force/ldsInstrumentation';
|
|
32
31
|
import { REFRESH_ADAPTER_EVENT, ADAPTER_UNFULFILLED_ERROR, instrument as instrument$3 } from 'force/ldsBindings';
|
|
33
32
|
import { counter, registerCacheStats, perfStart, perfEnd, registerPeriodicLogger, interaction, timer } from 'instrumentation/service';
|
|
33
|
+
import { instrument as instrument$2, setupLexNetworkAdapter } from 'force/ldsNetworkFetch';
|
|
34
34
|
import { instrument as instrument$4 } from 'force/adsBridge';
|
|
35
35
|
import { withRegistration, register, setDefaultLuvio } from 'force/ldsEngine';
|
|
36
36
|
import useHotspotLimit from '@salesforce/gate/lds.pdl.useHotspotLimit';
|
|
@@ -88,8 +88,8 @@ function buildServiceDescriptor$a() {
|
|
|
88
88
|
*/
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
const { create: create$1, freeze, keys: keys$
|
|
92
|
-
const { isArray: isArray$
|
|
91
|
+
const { create: create$1, freeze, keys: keys$2 } = Object;
|
|
92
|
+
const { isArray: isArray$2 } = Array;
|
|
93
93
|
const { stringify: stringify$1 } = JSON;
|
|
94
94
|
|
|
95
95
|
const LogLevelMap$1 = {
|
|
@@ -246,7 +246,7 @@ function stableJSONStringify$2(node) {
|
|
|
246
246
|
}
|
|
247
247
|
let i;
|
|
248
248
|
let out;
|
|
249
|
-
if (isArray$
|
|
249
|
+
if (isArray$2(node)) {
|
|
250
250
|
out = '[';
|
|
251
251
|
for (i = 0; i < node.length; i++) {
|
|
252
252
|
if (i) {
|
|
@@ -259,7 +259,7 @@ function stableJSONStringify$2(node) {
|
|
|
259
259
|
if (node === null) {
|
|
260
260
|
return 'null';
|
|
261
261
|
}
|
|
262
|
-
const objKeys = keys$
|
|
262
|
+
const objKeys = keys$2(node).sort();
|
|
263
263
|
out = '';
|
|
264
264
|
for (i = 0; i < objKeys.length; i++) {
|
|
265
265
|
const key = objKeys[i];
|
|
@@ -287,7 +287,7 @@ function toError(x) {
|
|
|
287
287
|
return new Error(typeof x === 'string' ? x : JSON.stringify(x));
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
var HttpStatusCode$
|
|
290
|
+
var HttpStatusCode$2;
|
|
291
291
|
(function (HttpStatusCode) {
|
|
292
292
|
HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
|
|
293
293
|
HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
|
|
@@ -299,7 +299,7 @@ var HttpStatusCode$1;
|
|
|
299
299
|
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
|
|
300
300
|
HttpStatusCode[HttpStatusCode["ServerError"] = 500] = "ServerError";
|
|
301
301
|
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
302
|
-
})(HttpStatusCode$
|
|
302
|
+
})(HttpStatusCode$2 || (HttpStatusCode$2 = {}));
|
|
303
303
|
|
|
304
304
|
/**
|
|
305
305
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -1293,7 +1293,7 @@ function loggerService(level, printer, formatter) {
|
|
|
1293
1293
|
return new ConsoleLogger(level, printer, formatter);
|
|
1294
1294
|
}
|
|
1295
1295
|
|
|
1296
|
-
var HttpStatusCode;
|
|
1296
|
+
var HttpStatusCode$1;
|
|
1297
1297
|
(function (HttpStatusCode) {
|
|
1298
1298
|
HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
|
|
1299
1299
|
HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
|
|
@@ -1305,7 +1305,7 @@ var HttpStatusCode;
|
|
|
1305
1305
|
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
|
|
1306
1306
|
HttpStatusCode[HttpStatusCode["ServerError"] = 500] = "ServerError";
|
|
1307
1307
|
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
1308
|
-
})(HttpStatusCode || (HttpStatusCode = {}));
|
|
1308
|
+
})(HttpStatusCode$1 || (HttpStatusCode$1 = {}));
|
|
1309
1309
|
|
|
1310
1310
|
/**
|
|
1311
1311
|
* Represents a JWT token with its decoded info and optional extra info.
|
|
@@ -1671,6 +1671,206 @@ function buildJwtRequestHeaderInterceptor(jwtManager, jwtRequestModifier = (_e,
|
|
|
1671
1671
|
};
|
|
1672
1672
|
}
|
|
1673
1673
|
|
|
1674
|
+
var SnapshotState;
|
|
1675
|
+
(function (SnapshotState) {
|
|
1676
|
+
SnapshotState["Fulfilled"] = "Fulfilled";
|
|
1677
|
+
SnapshotState["Unfulfilled"] = "Unfulfilled";
|
|
1678
|
+
SnapshotState["Error"] = "Error";
|
|
1679
|
+
SnapshotState["Pending"] = "Pending";
|
|
1680
|
+
SnapshotState["Stale"] = "Stale";
|
|
1681
|
+
})(SnapshotState || (SnapshotState = {}));
|
|
1682
|
+
const { isArray: isArray$1 } = Array;
|
|
1683
|
+
|
|
1684
|
+
Promise.resolve();
|
|
1685
|
+
|
|
1686
|
+
var StoreErrorStatus;
|
|
1687
|
+
(function (StoreErrorStatus) {
|
|
1688
|
+
StoreErrorStatus[StoreErrorStatus["RESOURCE_NOT_FOUND"] = 404] = "RESOURCE_NOT_FOUND";
|
|
1689
|
+
})(StoreErrorStatus || (StoreErrorStatus = {}));
|
|
1690
|
+
var StoreRecordType;
|
|
1691
|
+
(function (StoreRecordType) {
|
|
1692
|
+
StoreRecordType["Error"] = "error";
|
|
1693
|
+
})(StoreRecordType || (StoreRecordType = {}));
|
|
1694
|
+
var StoreLinkStateValues$1;
|
|
1695
|
+
(function (StoreLinkStateValues) {
|
|
1696
|
+
StoreLinkStateValues[StoreLinkStateValues["NotPresent"] = 0] = "NotPresent";
|
|
1697
|
+
StoreLinkStateValues[StoreLinkStateValues["RefNotPresent"] = 1] = "RefNotPresent";
|
|
1698
|
+
StoreLinkStateValues[StoreLinkStateValues["RefPresent"] = 2] = "RefPresent";
|
|
1699
|
+
StoreLinkStateValues[StoreLinkStateValues["Null"] = 3] = "Null";
|
|
1700
|
+
StoreLinkStateValues[StoreLinkStateValues["Missing"] = 4] = "Missing";
|
|
1701
|
+
StoreLinkStateValues[StoreLinkStateValues["Pending"] = 5] = "Pending";
|
|
1702
|
+
})(StoreLinkStateValues$1 || (StoreLinkStateValues$1 = {}));
|
|
1703
|
+
var StoreResolveResultState;
|
|
1704
|
+
(function (StoreResolveResultState) {
|
|
1705
|
+
StoreResolveResultState[StoreResolveResultState["Found"] = 0] = "Found";
|
|
1706
|
+
StoreResolveResultState[StoreResolveResultState["Error"] = 1] = "Error";
|
|
1707
|
+
StoreResolveResultState[StoreResolveResultState["Null"] = 2] = "Null";
|
|
1708
|
+
StoreResolveResultState[StoreResolveResultState["NotPresent"] = 3] = "NotPresent";
|
|
1709
|
+
StoreResolveResultState[StoreResolveResultState["Stale"] = 4] = "Stale";
|
|
1710
|
+
})(StoreResolveResultState || (StoreResolveResultState = {}));
|
|
1711
|
+
var HttpStatusCode;
|
|
1712
|
+
(function (HttpStatusCode) {
|
|
1713
|
+
HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
|
|
1714
|
+
HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
|
|
1715
|
+
HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
|
|
1716
|
+
HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
|
|
1717
|
+
HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
|
|
1718
|
+
HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
|
|
1719
|
+
HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
|
|
1720
|
+
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
|
|
1721
|
+
HttpStatusCode[HttpStatusCode["ServerError"] = 500] = "ServerError";
|
|
1722
|
+
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
1723
|
+
})(HttpStatusCode || (HttpStatusCode = {}));
|
|
1724
|
+
/**
|
|
1725
|
+
* A type guard function for determining if an unknown object is a {@link FormData}
|
|
1726
|
+
*/
|
|
1727
|
+
function isFormData(obj) {
|
|
1728
|
+
return (typeof obj === 'object' &&
|
|
1729
|
+
obj !== null &&
|
|
1730
|
+
'namedEntries' in obj &&
|
|
1731
|
+
isArray$1(obj.namedEntries));
|
|
1732
|
+
}
|
|
1733
|
+
/**
|
|
1734
|
+
* A type guard function for determining if an unknown object is a {@link FileReference}
|
|
1735
|
+
*/
|
|
1736
|
+
function isFileReference(entryValue) {
|
|
1737
|
+
return (typeof entryValue === 'object' &&
|
|
1738
|
+
entryValue !== null &&
|
|
1739
|
+
'isFileReference' in entryValue &&
|
|
1740
|
+
entryValue.isFileReference === true);
|
|
1741
|
+
}
|
|
1742
|
+
var GraphNodeType;
|
|
1743
|
+
(function (GraphNodeType) {
|
|
1744
|
+
GraphNodeType["Link"] = "Link";
|
|
1745
|
+
GraphNodeType["Node"] = "Node";
|
|
1746
|
+
GraphNodeType["Error"] = "Error";
|
|
1747
|
+
GraphNodeType["Locked"] = "Locked";
|
|
1748
|
+
})(GraphNodeType || (GraphNodeType = {}));
|
|
1749
|
+
|
|
1750
|
+
var StoreLinkStateValues;
|
|
1751
|
+
(function (StoreLinkStateValues) {
|
|
1752
|
+
StoreLinkStateValues[StoreLinkStateValues["NotPresent"] = 0] = "NotPresent";
|
|
1753
|
+
StoreLinkStateValues[StoreLinkStateValues["RefNotPresent"] = 1] = "RefNotPresent";
|
|
1754
|
+
StoreLinkStateValues[StoreLinkStateValues["RefPresent"] = 2] = "RefPresent";
|
|
1755
|
+
StoreLinkStateValues[StoreLinkStateValues["Null"] = 3] = "Null";
|
|
1756
|
+
StoreLinkStateValues[StoreLinkStateValues["Missing"] = 4] = "Missing";
|
|
1757
|
+
StoreLinkStateValues[StoreLinkStateValues["Pending"] = 5] = "Pending";
|
|
1758
|
+
})(StoreLinkStateValues || (StoreLinkStateValues = {}));
|
|
1759
|
+
var FragmentReadResultState;
|
|
1760
|
+
(function (FragmentReadResultState) {
|
|
1761
|
+
FragmentReadResultState[FragmentReadResultState["Missing"] = 0] = "Missing";
|
|
1762
|
+
FragmentReadResultState[FragmentReadResultState["Success"] = 1] = "Success";
|
|
1763
|
+
FragmentReadResultState[FragmentReadResultState["Error"] = 2] = "Error";
|
|
1764
|
+
})(FragmentReadResultState || (FragmentReadResultState = {}));
|
|
1765
|
+
({
|
|
1766
|
+
state: FragmentReadResultState.Missing,
|
|
1767
|
+
});
|
|
1768
|
+
|
|
1769
|
+
var ResourceParamType;
|
|
1770
|
+
(function (ResourceParamType) {
|
|
1771
|
+
ResourceParamType[ResourceParamType["UrlParameter"] = 0] = "UrlParameter";
|
|
1772
|
+
ResourceParamType[ResourceParamType["QueryParameter"] = 1] = "QueryParameter";
|
|
1773
|
+
ResourceParamType[ResourceParamType["Body"] = 2] = "Body";
|
|
1774
|
+
ResourceParamType[ResourceParamType["Header"] = 3] = "Header";
|
|
1775
|
+
})(ResourceParamType || (ResourceParamType = {}));
|
|
1776
|
+
var TypeCheckShapes;
|
|
1777
|
+
(function (TypeCheckShapes) {
|
|
1778
|
+
TypeCheckShapes[TypeCheckShapes["String"] = 0] = "String";
|
|
1779
|
+
TypeCheckShapes[TypeCheckShapes["Boolean"] = 1] = "Boolean";
|
|
1780
|
+
TypeCheckShapes[TypeCheckShapes["Number"] = 2] = "Number";
|
|
1781
|
+
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
1782
|
+
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
1783
|
+
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
1784
|
+
// engine version: 0.156.5-f5fd8c7a
|
|
1785
|
+
|
|
1786
|
+
const { keys: keys$1 } = Object;
|
|
1787
|
+
|
|
1788
|
+
// we're going to intentionally bundle this small bit of luvio engine code into
|
|
1789
|
+
// this module to keep it runtime dependency-free
|
|
1790
|
+
const fetchNetworkAdapter = async (resourceRequest, _resourceRequestContext) => {
|
|
1791
|
+
const { baseUri, basePath, body: requestBody, queryParams, method, headers } = resourceRequest;
|
|
1792
|
+
const qs = generateQueryString(queryParams);
|
|
1793
|
+
const path = `${baseUri}${basePath}${qs}`;
|
|
1794
|
+
let body;
|
|
1795
|
+
// some endpoints use FormData for POST request body, check here
|
|
1796
|
+
// if we have a POST body that is FormData
|
|
1797
|
+
if (method === 'post' && isFormData(requestBody)) {
|
|
1798
|
+
// we will populate a DOM FormData and pass that to fetch
|
|
1799
|
+
const newForm = new FormData();
|
|
1800
|
+
for (const { name, value } of requestBody.namedEntries) {
|
|
1801
|
+
// if this is a string or real DOM File then we can
|
|
1802
|
+
// just add it to FormData
|
|
1803
|
+
if (typeof value === 'string' || value instanceof File) {
|
|
1804
|
+
newForm.append(name, value);
|
|
1805
|
+
}
|
|
1806
|
+
// this network adapter doesn't currently support FileReference's
|
|
1807
|
+
else if (isFileReference(value)) {
|
|
1808
|
+
throw Error(`Luvio fetchNetworkAdapter does not support FileReference's`);
|
|
1809
|
+
}
|
|
1810
|
+
// else we have a Luvio File that isn't a real DOM file,
|
|
1811
|
+
// so we need to turn it into a DOM file
|
|
1812
|
+
else {
|
|
1813
|
+
const buffer = await value.arrayBuffer();
|
|
1814
|
+
newForm.append(name, new File([new Uint8Array(buffer)], value.name, {
|
|
1815
|
+
type: value.type,
|
|
1816
|
+
}));
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
body = newForm;
|
|
1820
|
+
}
|
|
1821
|
+
else if (requestBody === null) {
|
|
1822
|
+
body = null;
|
|
1823
|
+
}
|
|
1824
|
+
else {
|
|
1825
|
+
body = JSON.stringify(requestBody);
|
|
1826
|
+
headers['Content-Type'] = 'application/json';
|
|
1827
|
+
}
|
|
1828
|
+
const response = await fetch(path, {
|
|
1829
|
+
method: method.toUpperCase(),
|
|
1830
|
+
headers: generateHeaders(headers),
|
|
1831
|
+
body,
|
|
1832
|
+
});
|
|
1833
|
+
const { status, ok, statusText } = response;
|
|
1834
|
+
// coerce headers
|
|
1835
|
+
const responseHeaders = {};
|
|
1836
|
+
response.headers.forEach((value, key) => {
|
|
1837
|
+
responseHeaders[key] = value;
|
|
1838
|
+
});
|
|
1839
|
+
// parse body
|
|
1840
|
+
let responseBody = null;
|
|
1841
|
+
if (status !== 204) {
|
|
1842
|
+
const contentType = responseHeaders['content-type'];
|
|
1843
|
+
responseBody =
|
|
1844
|
+
contentType && contentType.startsWith('application/json')
|
|
1845
|
+
? await response.json()
|
|
1846
|
+
: await response.text();
|
|
1847
|
+
}
|
|
1848
|
+
return {
|
|
1849
|
+
body: responseBody,
|
|
1850
|
+
status,
|
|
1851
|
+
statusText,
|
|
1852
|
+
ok,
|
|
1853
|
+
headers: responseHeaders,
|
|
1854
|
+
};
|
|
1855
|
+
};
|
|
1856
|
+
function generateQueryString(params) {
|
|
1857
|
+
const queryStrings = [];
|
|
1858
|
+
for (const key of keys$1(params)) {
|
|
1859
|
+
queryStrings.push(`${key}=${params[key]}`);
|
|
1860
|
+
}
|
|
1861
|
+
if (queryStrings.length > 0) {
|
|
1862
|
+
return `?${queryStrings.join('&')}`;
|
|
1863
|
+
}
|
|
1864
|
+
return '';
|
|
1865
|
+
}
|
|
1866
|
+
function generateHeaders(headers) {
|
|
1867
|
+
const fetchHeaders = new Headers();
|
|
1868
|
+
for (const key of keys$1(headers)) {
|
|
1869
|
+
fetchHeaders.set(key, headers[key]);
|
|
1870
|
+
}
|
|
1871
|
+
return fetchHeaders;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1674
1874
|
const SALESFORCE_API_BASE_URI_FLAG = 'api.salesforce.com';
|
|
1675
1875
|
const SFAPController = 'SalesforceApiPlatformController';
|
|
1676
1876
|
const SFAPJwtMethod = 'getSFAPLightningJwtService';
|
|
@@ -1713,7 +1913,7 @@ const platformSfapJwtResolver = {
|
|
|
1713
1913
|
}
|
|
1714
1914
|
// AuraFetchResponse errors
|
|
1715
1915
|
const { status } = error;
|
|
1716
|
-
if (status !== HttpStatusCode$
|
|
1916
|
+
if (status !== HttpStatusCode$3.ServerError) {
|
|
1717
1917
|
// ConnectInJavaError
|
|
1718
1918
|
reject(error.body.message);
|
|
1719
1919
|
return;
|
|
@@ -1723,6 +1923,20 @@ const platformSfapJwtResolver = {
|
|
|
1723
1923
|
});
|
|
1724
1924
|
},
|
|
1725
1925
|
};
|
|
1926
|
+
const jwtManager = new JwtManager(new JwtRepository(), platformSfapJwtResolver);
|
|
1927
|
+
const authenticateRequest = (resourceRequest, jwt) => {
|
|
1928
|
+
const { token } = jwt;
|
|
1929
|
+
const { headers } = resourceRequest;
|
|
1930
|
+
// Only supporting Bearer <auth-scheme>
|
|
1931
|
+
const authenticatedHeaders = {
|
|
1932
|
+
...headers,
|
|
1933
|
+
Authorization: `Bearer ${token}`,
|
|
1934
|
+
};
|
|
1935
|
+
return {
|
|
1936
|
+
...resourceRequest,
|
|
1937
|
+
headers: authenticatedHeaders,
|
|
1938
|
+
};
|
|
1939
|
+
};
|
|
1726
1940
|
/**
|
|
1727
1941
|
* This hook is used to modify the resource request before it is sent to the server.
|
|
1728
1942
|
* SFAP uses extraInfo assocaiated JwtToken to update the baseUri for the resource request.
|
|
@@ -1738,7 +1952,29 @@ const modifySfapResourceRequest = function (resourceRequest, jwtToken) {
|
|
|
1738
1952
|
baseUri,
|
|
1739
1953
|
};
|
|
1740
1954
|
};
|
|
1741
|
-
const sfapNetworkAdapter =
|
|
1955
|
+
const sfapNetworkAdapter = async (resourceRequest, resourceRequestContext) => {
|
|
1956
|
+
let jwtToken;
|
|
1957
|
+
try {
|
|
1958
|
+
jwtToken = await jwtManager.getJwt();
|
|
1959
|
+
}
|
|
1960
|
+
catch (error) {
|
|
1961
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1962
|
+
throw new Error(`There was an error while fetching Jwt token: ${JSON.stringify(error)}`);
|
|
1963
|
+
}
|
|
1964
|
+
return Promise.reject(new LdsNetworkAdapterErrorResponse('Unable to fetch the jwt required to make this request', error));
|
|
1965
|
+
}
|
|
1966
|
+
let authenticatedRequest = authenticateRequest(resourceRequest, jwtToken);
|
|
1967
|
+
authenticatedRequest = modifySfapResourceRequest(authenticatedRequest, jwtToken);
|
|
1968
|
+
return fetchNetworkAdapter(authenticatedRequest);
|
|
1969
|
+
};
|
|
1970
|
+
class LdsNetworkAdapterErrorResponse extends Error {
|
|
1971
|
+
constructor(message, _error) {
|
|
1972
|
+
super(message);
|
|
1973
|
+
this._error = _error;
|
|
1974
|
+
this.errorType = 'networkAdapterError';
|
|
1975
|
+
this.name = this.constructor.name;
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1742
1978
|
const composedNetworkAdapter$1 = {
|
|
1743
1979
|
shouldHandleRequest(resourceRequest) {
|
|
1744
1980
|
return resourceRequest.baseUri === SALESFORCE_API_BASE_URI_FLAG;
|
|
@@ -4375,7 +4611,7 @@ function getEnvironmentSetting(name) {
|
|
|
4375
4611
|
}
|
|
4376
4612
|
return undefined;
|
|
4377
4613
|
}
|
|
4378
|
-
// version: 1.
|
|
4614
|
+
// version: 1.333.0-257d60dcfb
|
|
4379
4615
|
|
|
4380
4616
|
const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
|
|
4381
4617
|
//TODO: Some duplication here that can be most likely moved to a util class
|
|
@@ -4592,45 +4828,38 @@ function setRejectConfig(request, error) {
|
|
|
4592
4828
|
|
|
4593
4829
|
const API_PATHS = [
|
|
4594
4830
|
// getLookupActions
|
|
4595
|
-
'/ui-api/actions/lookup/{objectApiNames}',
|
|
4831
|
+
// '/ui-api/actions/lookup/{objectApiNames}',
|
|
4596
4832
|
// getRecordActions
|
|
4597
4833
|
'/ui-api/actions/record/{recordIds}',
|
|
4598
4834
|
// getRelatedListActions
|
|
4599
|
-
'/ui-api/actions/record/{recordIds}/related-list/{relatedListId}',
|
|
4835
|
+
// '/ui-api/actions/record/{recordIds}/related-list/{relatedListId}',
|
|
4600
4836
|
// getDuplicateConfiguration
|
|
4601
|
-
'/ui-api/duplicates/{objectApiName}',
|
|
4837
|
+
// '/ui-api/duplicates/{objectApiName}',
|
|
4602
4838
|
// getListInfosByObjectName
|
|
4603
|
-
'/ui-api/list-info/{objectApiName}',
|
|
4839
|
+
// '/ui-api/list-info/{objectApiName}',
|
|
4604
4840
|
// getLookupRecords
|
|
4605
|
-
'/ui-api/lookups/{objectApiName}/{fieldApiName}',
|
|
4841
|
+
// '/ui-api/lookups/{objectApiName}/{fieldApiName}',
|
|
4606
4842
|
// getObjectInfo
|
|
4607
4843
|
'/ui-api/object-info/{objectApiName}',
|
|
4608
4844
|
// getObjectInfos
|
|
4609
|
-
'/ui-api/object-info/batch/{objectApiNames}',
|
|
4845
|
+
// '/ui-api/object-info/batch/{objectApiNames}',
|
|
4610
4846
|
// getPicklistValuesByRecordType
|
|
4611
|
-
'/ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}',
|
|
4847
|
+
// '/ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}',
|
|
4612
4848
|
// getDuplicates
|
|
4613
|
-
'/ui-api/predupe',
|
|
4849
|
+
// '/ui-api/predupe',
|
|
4614
4850
|
// getRecord
|
|
4615
4851
|
'/ui-api/records/{recordId}',
|
|
4616
4852
|
// getRecordUi
|
|
4617
4853
|
'/ui-api/record-ui/{recordIds}',
|
|
4618
4854
|
// getRelatedListInfo
|
|
4619
|
-
'/ui-api/related-list-info/{parentObjectApiName}/{relatedListId}',
|
|
4855
|
+
// '/ui-api/related-list-info/{parentObjectApiName}/{relatedListId}',
|
|
4620
4856
|
// getRelatedListRecords
|
|
4621
|
-
'/ui-api/related-list-records/{parentRecordId}/{relatedListId}',
|
|
4857
|
+
// '/ui-api/related-list-records/{parentRecordId}/{relatedListId}',
|
|
4622
4858
|
];
|
|
4623
4859
|
const API_PATH_MATCHERS = API_PATHS.map((path) => {
|
|
4624
4860
|
const regexString = path.replace(/\{.+?\}/g, '[^/]+');
|
|
4625
4861
|
return new RegExp(`^${regexString}$`);
|
|
4626
4862
|
});
|
|
4627
|
-
const modifyLexResourceRequest = function (resourceRequest, jwtToken) {
|
|
4628
|
-
const jwtBaseUri = jwtToken.decodedInfo.iss;
|
|
4629
|
-
return {
|
|
4630
|
-
...resourceRequest,
|
|
4631
|
-
baseUri: jwtBaseUri + resourceRequest.baseUri,
|
|
4632
|
-
};
|
|
4633
|
-
};
|
|
4634
4863
|
const requestTracker = {
|
|
4635
4864
|
registerHandler: (request, name, loadedCheck) => {
|
|
4636
4865
|
ThirdPartyTracker.registerHandler(request, name, loadedCheck);
|
|
@@ -4655,7 +4884,7 @@ const composedFetchNetworkAdapter = {
|
|
|
4655
4884
|
}
|
|
4656
4885
|
return API_PATH_MATCHERS.some((matcher) => matcher.test(path));
|
|
4657
4886
|
},
|
|
4658
|
-
adapter:
|
|
4887
|
+
adapter: setupLexNetworkAdapter(requestTracker, requestLogger),
|
|
4659
4888
|
};
|
|
4660
4889
|
|
|
4661
4890
|
function getComposedAdapters() {
|
|
@@ -5074,4 +5303,4 @@ function ldsEngineCreator() {
|
|
|
5074
5303
|
}
|
|
5075
5304
|
|
|
5076
5305
|
export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
|
|
5077
|
-
// version: 1.
|
|
5306
|
+
// version: 1.333.0-8003e34441
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ResourceRequest } from '@luvio/engine';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const modifyLexResourceRequest: ModifyResourceRequestHook<unknown, any>;
|
|
2
|
+
import type { RequestLogger } from '@salesforce/lds-network-fetch';
|
|
4
3
|
export declare const requestLogger: RequestLogger;
|
|
5
4
|
export declare const composedFetchNetworkAdapter: {
|
|
6
5
|
shouldHandleRequest(resourceRequest: ResourceRequest): boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FetchResponse, ResourceRequest, ResourceRequestContext } from '@luvio/engine';
|
|
2
2
|
import type { JwtResolver } from '@luvio/jwt-manager';
|
|
3
|
-
import type { ModifyResourceRequestHook } from '@salesforce/lds-network-fetch-with-jwt';
|
|
4
3
|
export declare const SFAPController = "SalesforceApiPlatformController";
|
|
5
4
|
export declare const SFAPJwtMethod = "getSFAPLightningJwtService";
|
|
6
5
|
export type ExtraInfo = {
|
|
@@ -11,17 +10,8 @@ export type ExtraInfo = {
|
|
|
11
10
|
* {@link JwtResolver} for platform SFAP
|
|
12
11
|
*/
|
|
13
12
|
export declare const platformSfapJwtResolver: JwtResolver<ExtraInfo>;
|
|
14
|
-
/**
|
|
15
|
-
* This hook is used to modify the resource request before it is sent to the server.
|
|
16
|
-
* SFAP uses extraInfo assocaiated JwtToken to update the baseUri for the resource request.
|
|
17
|
-
*
|
|
18
|
-
* @param resourceRequest
|
|
19
|
-
* @param jwtToken
|
|
20
|
-
* @returns resourceRequest with updated baseUri
|
|
21
|
-
*/
|
|
22
|
-
export declare const modifySfapResourceRequest: ModifyResourceRequestHook<unknown, ExtraInfo>;
|
|
23
13
|
declare const composedNetworkAdapter: {
|
|
24
14
|
shouldHandleRequest(resourceRequest: ResourceRequest): boolean;
|
|
25
|
-
adapter:
|
|
15
|
+
adapter: (resourceRequest: ResourceRequest, resourceRequestContext: ResourceRequestContext) => Promise<FetchResponse<any>>;
|
|
26
16
|
};
|
|
27
17
|
export default composedNetworkAdapter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-aura",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.333.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Aura runtime",
|
|
6
6
|
"main": "dist/ldsEngineCreator.js",
|
|
@@ -34,43 +34,43 @@
|
|
|
34
34
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@luvio/service-provisioner": "5.
|
|
38
|
-
"@salesforce/lds-adapters-apex": "^1.
|
|
39
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
37
|
+
"@luvio/service-provisioner": "5.24.1",
|
|
38
|
+
"@salesforce/lds-adapters-apex": "^1.333.0",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.333.0",
|
|
40
40
|
"@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
|
|
41
|
-
"@salesforce/lds-ads-bridge": "^1.
|
|
42
|
-
"@salesforce/lds-aura-storage": "^1.
|
|
43
|
-
"@salesforce/lds-bindings": "^1.
|
|
44
|
-
"@salesforce/lds-instrumentation": "^1.
|
|
45
|
-
"@salesforce/lds-network-aura": "^1.
|
|
46
|
-
"@salesforce/lds-network-fetch
|
|
41
|
+
"@salesforce/lds-ads-bridge": "^1.333.0",
|
|
42
|
+
"@salesforce/lds-aura-storage": "^1.333.0",
|
|
43
|
+
"@salesforce/lds-bindings": "^1.333.0",
|
|
44
|
+
"@salesforce/lds-instrumentation": "^1.333.0",
|
|
45
|
+
"@salesforce/lds-network-aura": "^1.333.0",
|
|
46
|
+
"@salesforce/lds-network-fetch": "^1.333.0",
|
|
47
47
|
"jwt-encode": "1.0.1"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@luvio/command-aura-network": "5.
|
|
51
|
-
"@luvio/command-aura-resource-cache-control": "5.
|
|
52
|
-
"@luvio/command-fetch-network": "5.
|
|
53
|
-
"@luvio/command-network": "5.
|
|
54
|
-
"@luvio/command-sse": "5.
|
|
55
|
-
"@luvio/command-streaming": "5.
|
|
50
|
+
"@luvio/command-aura-network": "5.24.1",
|
|
51
|
+
"@luvio/command-aura-resource-cache-control": "5.24.1",
|
|
52
|
+
"@luvio/command-fetch-network": "5.24.1",
|
|
53
|
+
"@luvio/command-network": "5.24.1",
|
|
54
|
+
"@luvio/command-sse": "5.24.1",
|
|
55
|
+
"@luvio/command-streaming": "5.24.1",
|
|
56
56
|
"@luvio/network-adapter-composable": "0.156.5",
|
|
57
57
|
"@luvio/network-adapter-fetch": "0.156.5",
|
|
58
|
-
"@luvio/service-aura-network": "5.
|
|
59
|
-
"@luvio/service-cache": "5.
|
|
60
|
-
"@luvio/service-cache-control": "5.
|
|
61
|
-
"@luvio/service-fetch-network": "5.
|
|
62
|
-
"@luvio/service-instrument-command": "5.
|
|
63
|
-
"@luvio/service-store": "5.
|
|
64
|
-
"@luvio/utils": "5.
|
|
65
|
-
"@salesforce/lds-adapters-uiapi-lex": "^1.
|
|
58
|
+
"@luvio/service-aura-network": "5.24.1",
|
|
59
|
+
"@luvio/service-cache": "5.24.1",
|
|
60
|
+
"@luvio/service-cache-control": "5.24.1",
|
|
61
|
+
"@luvio/service-fetch-network": "5.24.1",
|
|
62
|
+
"@luvio/service-instrument-command": "5.24.1",
|
|
63
|
+
"@luvio/service-store": "5.24.1",
|
|
64
|
+
"@luvio/utils": "5.24.1",
|
|
65
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.333.0"
|
|
66
66
|
},
|
|
67
67
|
"luvioBundlesize": [
|
|
68
68
|
{
|
|
69
69
|
"path": "./dist/ldsEngineCreator.js",
|
|
70
70
|
"maxSize": {
|
|
71
|
-
"none": "
|
|
72
|
-
"min": "
|
|
73
|
-
"compressed": "
|
|
71
|
+
"none": "200 kB",
|
|
72
|
+
"min": "83 kB",
|
|
73
|
+
"compressed": "36 kB"
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
],
|