@salesforce/lds-runtime-aura 1.309.0-dev18 → 1.309.0-dev20
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
CHANGED
|
@@ -1699,34 +1699,71 @@ const composedNetworkAdapter$1 = {
|
|
|
1699
1699
|
function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n("Invalid token specified");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(".")[o]))}catch(e){throw new n("Invalid token specified: "+e.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";
|
|
1700
1700
|
|
|
1701
1701
|
const SFAP_BASE_URL = 'api.salesforce.com';
|
|
1702
|
+
const sfapJwtRepository = new JwtRepository();
|
|
1703
|
+
const sfapJwtManager = new JwtManager(sfapJwtRepository, platformSfapJwtResolver);
|
|
1702
1704
|
function buildJwtAuthorizedSfapFetchService(logger) {
|
|
1703
|
-
const
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
if (typeof resource !== 'string' && !(resource instanceof URL)) {
|
|
1707
|
-
// istanbul ignore else: this will not be tested in NODE_ENV = production for test coverage
|
|
1708
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1709
|
-
throw new Error('SFAP fetch service expects a string or URL resource');
|
|
1710
|
-
}
|
|
1711
|
-
return [resource, request];
|
|
1712
|
-
}
|
|
1713
|
-
const overrideUrl = new URL(baseUri);
|
|
1714
|
-
const url = typeof resource === 'string' ? new URL(resource) : new URL(resource.toString());
|
|
1715
|
-
if (!(url.host === SFAP_BASE_URL)) {
|
|
1716
|
-
logger.warn(`SFAP fetch service requires that the host of the resource is ${SFAP_BASE_URL}`);
|
|
1717
|
-
return [resource, request];
|
|
1718
|
-
}
|
|
1719
|
-
url.host = overrideUrl.host;
|
|
1720
|
-
url.protocol = overrideUrl.protocol;
|
|
1721
|
-
return [url, request];
|
|
1722
|
-
};
|
|
1723
|
-
const jwtRequestHeaderInterceptor = buildJwtRequestHeaderInterceptor(jwtManager, jwtRequestModifier);
|
|
1724
|
-
const jwtAuthorizedFetchService = buildFetchService({ request: [jwtRequestHeaderInterceptor] });
|
|
1705
|
+
const jwtAuthorizedFetchService = buildFetchService({
|
|
1706
|
+
request: [buildJwtRequestInterceptor(logger)],
|
|
1707
|
+
});
|
|
1725
1708
|
return {
|
|
1726
1709
|
...jwtAuthorizedFetchService,
|
|
1727
1710
|
tags: { authenticationScopes: 'sfap_api' },
|
|
1728
1711
|
};
|
|
1729
1712
|
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Returns a service descriptor for a fetch service that includes one-off copilot
|
|
1715
|
+
* hacks. This fetch service is not intended for use by anything other than
|
|
1716
|
+
* copilot commands.
|
|
1717
|
+
*/
|
|
1718
|
+
function buildCopilotFetchServiceDescriptor(logger) {
|
|
1719
|
+
return {
|
|
1720
|
+
// Note that this layers the Interceptor below directly on top of fetch(). WHen
|
|
1721
|
+
// we switch to JWT authentication this will need to change to incorporate the
|
|
1722
|
+
// Interceptor here with the logic in buildJwtAuthorizedSfapFetchServiceDescriptor()
|
|
1723
|
+
// above.
|
|
1724
|
+
...buildFetchService({
|
|
1725
|
+
request: [
|
|
1726
|
+
// Note that this function is VERY closely tied to the fetchParams generated
|
|
1727
|
+
// by copilotStartSessionCommand. Any changes to those parameters will require
|
|
1728
|
+
// corresponding updates to the logic below.
|
|
1729
|
+
(args) => {
|
|
1730
|
+
const [url, requestInit] = args;
|
|
1731
|
+
// ignore anything other than a start session request
|
|
1732
|
+
if (typeof url !== 'string' ||
|
|
1733
|
+
!url.endsWith('/sessions') ||
|
|
1734
|
+
!requestInit ||
|
|
1735
|
+
requestInit.method !== 'POST' ||
|
|
1736
|
+
!requestInit.body ||
|
|
1737
|
+
typeof requestInit.body !== 'string') {
|
|
1738
|
+
return resolvedPromiseLike(args);
|
|
1739
|
+
}
|
|
1740
|
+
return resolvedPromiseLike(sfapJwtManager.getJwt()).then((token) => {
|
|
1741
|
+
// replace the body's instanceConfig.endpoint with the JWT's iss value
|
|
1742
|
+
const body = JSON.parse(requestInit.body);
|
|
1743
|
+
if (!body || !token.decodedInfo || !token.decodedInfo.iss) {
|
|
1744
|
+
logger.warn('skipping injection of endpoint into start session request');
|
|
1745
|
+
}
|
|
1746
|
+
else {
|
|
1747
|
+
if (!body.instanceConfig) {
|
|
1748
|
+
body.instanceConfig = {};
|
|
1749
|
+
}
|
|
1750
|
+
body.instanceConfig.endpoint = token.decodedInfo.iss;
|
|
1751
|
+
}
|
|
1752
|
+
return [
|
|
1753
|
+
args[0],
|
|
1754
|
+
{
|
|
1755
|
+
...args[1],
|
|
1756
|
+
body: JSON.stringify(body),
|
|
1757
|
+
},
|
|
1758
|
+
];
|
|
1759
|
+
});
|
|
1760
|
+
},
|
|
1761
|
+
buildJwtRequestInterceptor(logger),
|
|
1762
|
+
],
|
|
1763
|
+
}),
|
|
1764
|
+
tags: { specialHacksFor: 'copilot' },
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1730
1767
|
const lightningJwtResolver = {
|
|
1731
1768
|
getJwt() {
|
|
1732
1769
|
// JWT Manager should be updated to use promise like instead of promise to accomadate use cases like this
|
|
@@ -1772,6 +1809,28 @@ function buildUnauthorizedFetchService() {
|
|
|
1772
1809
|
tags: { authenticationScopes: '' },
|
|
1773
1810
|
};
|
|
1774
1811
|
}
|
|
1812
|
+
function buildJwtRequestInterceptor(logger) {
|
|
1813
|
+
const jwtRequestModifier = ({ baseUri }, [resource, request]) => {
|
|
1814
|
+
if (typeof resource !== 'string' && !(resource instanceof URL)) {
|
|
1815
|
+
// istanbul ignore else: this will not be tested in NODE_ENV = production for test coverage
|
|
1816
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1817
|
+
throw new Error('SFAP fetch service expects a string or URL resource');
|
|
1818
|
+
}
|
|
1819
|
+
return [resource, request];
|
|
1820
|
+
}
|
|
1821
|
+
const overrideUrl = new URL(baseUri);
|
|
1822
|
+
const url = typeof resource === 'string' ? new URL(resource) : new URL(resource.toString());
|
|
1823
|
+
if (!(url.host === SFAP_BASE_URL)) {
|
|
1824
|
+
logger.warn(`SFAP fetch service requires that the host of the resource is ${SFAP_BASE_URL}`);
|
|
1825
|
+
return [resource, request];
|
|
1826
|
+
}
|
|
1827
|
+
url.host = overrideUrl.host;
|
|
1828
|
+
url.protocol = overrideUrl.protocol;
|
|
1829
|
+
return [url, request];
|
|
1830
|
+
};
|
|
1831
|
+
const jwtRequestHeaderInterceptor = buildJwtRequestHeaderInterceptor(sfapJwtManager, jwtRequestModifier);
|
|
1832
|
+
return jwtRequestHeaderInterceptor;
|
|
1833
|
+
}
|
|
1775
1834
|
|
|
1776
1835
|
const PDL_EXECUTE_ASYNC_OPTIONS = {
|
|
1777
1836
|
LOG_ERROR_ONLY: true,
|
|
@@ -4130,7 +4189,7 @@ function getEnvironmentSetting(name) {
|
|
|
4130
4189
|
}
|
|
4131
4190
|
return undefined;
|
|
4132
4191
|
}
|
|
4133
|
-
// version: 1.309.0-
|
|
4192
|
+
// version: 1.309.0-dev20-96b0b3663c
|
|
4134
4193
|
|
|
4135
4194
|
const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
|
|
4136
4195
|
//TODO: Some duplication here that can be most likely moved to a util class
|
|
@@ -4718,6 +4777,7 @@ function initializeOneStore() {
|
|
|
4718
4777
|
const services = [
|
|
4719
4778
|
buildUnauthorizedFetchService(),
|
|
4720
4779
|
buildJwtAuthorizedSfapFetchService(loggerService),
|
|
4780
|
+
buildCopilotFetchServiceDescriptor(loggerService),
|
|
4721
4781
|
buildJwtAuthorizedLightningFetchService(),
|
|
4722
4782
|
keySubscriptionServiceDescriptor,
|
|
4723
4783
|
metadataRepositoryServiceDescriptor,
|
|
@@ -4764,4 +4824,4 @@ function ldsEngineCreator() {
|
|
|
4764
4824
|
}
|
|
4765
4825
|
|
|
4766
4826
|
export { buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, whenPredictionsReady };
|
|
4767
|
-
// version: 1.309.0-
|
|
4827
|
+
// version: 1.309.0-dev20-7df11c6508
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { type FetchServiceDescriptor } from '@luvio/service-fetch-network/v1';
|
|
2
2
|
import { type LoggerService } from '@luvio/utils';
|
|
3
3
|
export declare function buildJwtAuthorizedSfapFetchService(logger: LoggerService): FetchServiceDescriptor;
|
|
4
|
+
/**
|
|
5
|
+
* Returns a service descriptor for a fetch service that includes one-off copilot
|
|
6
|
+
* hacks. This fetch service is not intended for use by anything other than
|
|
7
|
+
* copilot commands.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildCopilotFetchServiceDescriptor(logger: LoggerService): FetchServiceDescriptor;
|
|
4
10
|
export declare const lightningJwtResolver: {
|
|
5
11
|
getJwt(): Promise<any>;
|
|
6
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-aura",
|
|
3
|
-
"version": "1.309.0-
|
|
3
|
+
"version": "1.309.0-dev20",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Aura runtime",
|
|
6
6
|
"main": "dist/ldsEngineCreator.js",
|
|
@@ -35,15 +35,16 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@luvio/service-broker": "5.3.2-dev2",
|
|
38
|
-
"@salesforce/lds-adapters-apex": "^1.309.0-
|
|
39
|
-
"@salesforce/lds-adapters-uiapi": "^1.309.0-
|
|
38
|
+
"@salesforce/lds-adapters-apex": "^1.309.0-dev20",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.309.0-dev20",
|
|
40
40
|
"@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
|
|
41
|
-
"@salesforce/lds-ads-bridge": "^1.309.0-
|
|
42
|
-
"@salesforce/lds-aura-storage": "^1.309.0-
|
|
43
|
-
"@salesforce/lds-bindings": "^1.309.0-
|
|
44
|
-
"@salesforce/lds-instrumentation": "^1.309.0-
|
|
45
|
-
"@salesforce/lds-network-aura": "^1.309.0-
|
|
46
|
-
"@salesforce/lds-network-fetch-with-jwt": "^1.309.0-
|
|
41
|
+
"@salesforce/lds-ads-bridge": "^1.309.0-dev20",
|
|
42
|
+
"@salesforce/lds-aura-storage": "^1.309.0-dev20",
|
|
43
|
+
"@salesforce/lds-bindings": "^1.309.0-dev20",
|
|
44
|
+
"@salesforce/lds-instrumentation": "^1.309.0-dev20",
|
|
45
|
+
"@salesforce/lds-network-aura": "^1.309.0-dev20",
|
|
46
|
+
"@salesforce/lds-network-fetch-with-jwt": "^1.309.0-dev20",
|
|
47
|
+
"jwt-encode": "1.0.1"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
50
|
"@luvio/command-aura-network": "5.3.2-dev2",
|
|
@@ -64,15 +65,15 @@
|
|
|
64
65
|
"@luvio/service-subscription": "5.3.2-dev2",
|
|
65
66
|
"@luvio/service-type-registry": "5.3.2-dev2",
|
|
66
67
|
"@luvio/utils": "5.3.2-dev2",
|
|
67
|
-
"@salesforce/lds-adapters-uiapi-lex": "^1.309.0-
|
|
68
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.309.0-dev20"
|
|
68
69
|
},
|
|
69
70
|
"luvioBundlesize": [
|
|
70
71
|
{
|
|
71
72
|
"path": "./dist/ldsEngineCreator.js",
|
|
72
73
|
"maxSize": {
|
|
73
|
-
"none": "
|
|
74
|
-
"min": "
|
|
75
|
-
"compressed": "
|
|
74
|
+
"none": "183 kB",
|
|
75
|
+
"min": "77 kB",
|
|
76
|
+
"compressed": "33 kB"
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
],
|