@salesforce/lds-runtime-aura 1.235.0 → 1.237.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
CHANGED
|
@@ -12,15 +12,16 @@
|
|
|
12
12
|
* *******************************************************************************************
|
|
13
13
|
*/
|
|
14
14
|
/* proxy-compat-disable */
|
|
15
|
-
import { InMemoryStore, Environment, Luvio, InMemoryStoreQueryEvaluator } from 'force/luvioEngine';
|
|
15
|
+
import { HttpStatusCode, InMemoryStore, Environment, Luvio, InMemoryStoreQueryEvaluator } from 'force/luvioEngine';
|
|
16
16
|
import ldsTrackedFieldsBehaviorGate from '@salesforce/gate/lds.useNewTrackedFieldBehavior';
|
|
17
17
|
import { instrument, configuration, InMemoryRecordRepresentationQueryEvaluator, UiApiNamespace, RecordRepresentationRepresentationType } from 'force/ldsAdaptersUiapi';
|
|
18
18
|
import { withRegistration, register, setDefaultLuvio } from 'force/ldsEngine';
|
|
19
19
|
import { REFRESH_ADAPTER_EVENT, ADAPTER_UNFULFILLED_ERROR, instrument as instrument$2 } from 'force/ldsBindings';
|
|
20
20
|
import { counter, registerCacheStats, perfStart, perfEnd, registerPeriodicLogger, interaction, timer } from 'instrumentation/service';
|
|
21
21
|
import { LRUCache, instrumentAdapter, instrumentLuvio, setupInstrumentation as setupInstrumentation$1, logObjectInfoChanged as logObjectInfoChanged$1, updatePercentileHistogramMetric, incrementCounterMetric, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from 'force/ldsInstrumentation';
|
|
22
|
-
import networkAdapter, { instrument as instrument$1, forceRecordTransactionsDisabled, ldsNetworkAdapterInstrument } from 'force/ldsNetwork';
|
|
22
|
+
import networkAdapter, { instrument as instrument$1, forceRecordTransactionsDisabled, ldsNetworkAdapterInstrument, dispatchAuraAction, defaultActionConfig } from 'force/ldsNetwork';
|
|
23
23
|
import { instrument as instrument$3 } from 'force/adsBridge';
|
|
24
|
+
import { buildJwtNetworkAdapter } from 'force/ldsNetworkFetchWithJwt';
|
|
24
25
|
import { clearStorages } from 'force/ldsStorage';
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -620,6 +621,73 @@ function setupMetadataWatcher(luvio) {
|
|
|
620
621
|
});
|
|
621
622
|
}
|
|
622
623
|
|
|
624
|
+
const SFAPController = 'SalesforceApiPlatformController';
|
|
625
|
+
const SFAPJwtMethod = 'getSFAPLightningJwtService';
|
|
626
|
+
/**
|
|
627
|
+
* We expect jwt info and baseUri to be present in the response.
|
|
628
|
+
*
|
|
629
|
+
* @param body
|
|
630
|
+
*/
|
|
631
|
+
function validateResponse(body) {
|
|
632
|
+
if (!body || !body.jwt || !body.baseUri) {
|
|
633
|
+
// wrapped the invocation in env conditional
|
|
634
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
635
|
+
throw new Error(`Expected jwt info and baseUri to be present but instead got: ${JSON.stringify(body)}`);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Resolves Jwt token for SFAP by calling Aura action
|
|
640
|
+
* {@link JwtResolver} for platform SFAP
|
|
641
|
+
*/
|
|
642
|
+
const platformSfapJwtResolver = {
|
|
643
|
+
getJwt() {
|
|
644
|
+
return new Promise((resolve, reject) => {
|
|
645
|
+
dispatchAuraAction(`${SFAPController}.${SFAPJwtMethod}`, {}, defaultActionConfig)
|
|
646
|
+
.then((response) => {
|
|
647
|
+
const body = response.body;
|
|
648
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
649
|
+
validateResponse(body);
|
|
650
|
+
}
|
|
651
|
+
resolve({
|
|
652
|
+
jwt: body.jwt,
|
|
653
|
+
extraInfo: {
|
|
654
|
+
baseUri: body.baseUri,
|
|
655
|
+
},
|
|
656
|
+
});
|
|
657
|
+
})
|
|
658
|
+
.catch((error) => {
|
|
659
|
+
if (error instanceof Error) {
|
|
660
|
+
reject(error.message);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
// AuraFetchResponse errors
|
|
664
|
+
const { status } = error;
|
|
665
|
+
if (status !== HttpStatusCode.ServerError) {
|
|
666
|
+
// ConnectInJavaError
|
|
667
|
+
reject(error.body.message);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
reject(error.body.error);
|
|
671
|
+
});
|
|
672
|
+
});
|
|
673
|
+
},
|
|
674
|
+
};
|
|
675
|
+
/**
|
|
676
|
+
* This hook is used to modify the resource request before it is sent to the server.
|
|
677
|
+
* SFAP uses extraInfo assocaiated JwtToken to update the baseUri for the resource request.
|
|
678
|
+
*
|
|
679
|
+
* @param resourceRequest
|
|
680
|
+
* @param jwtToken
|
|
681
|
+
* @returns resourceRequest with updated baseUri
|
|
682
|
+
*/
|
|
683
|
+
const modifySfapResourceRequest = function (resourceRequest, jwtToken) {
|
|
684
|
+
const { baseUri } = jwtToken.extraInfo;
|
|
685
|
+
return {
|
|
686
|
+
...resourceRequest,
|
|
687
|
+
baseUri,
|
|
688
|
+
};
|
|
689
|
+
};
|
|
690
|
+
|
|
623
691
|
// This code *should* be in lds-network-adapter, but when combined with the Aura
|
|
624
692
|
// component test workaround in lds-default-luvio it creates a circular dependecy
|
|
625
693
|
// between lds-default-luvio and lds-network-adapter. We do the register on behalf
|
|
@@ -646,6 +714,8 @@ function setupQueryEvaluators(luvio, store) {
|
|
|
646
714
|
luvio.registerStoreQueryEvaluator(baseQueryEvaluator);
|
|
647
715
|
luvio.registerTypeQueryEvaluator(UiApiNamespace, RecordRepresentationRepresentationType, recordRepresentationQueryEvaluator);
|
|
648
716
|
}
|
|
717
|
+
// Should be used by the Integration WI
|
|
718
|
+
buildJwtNetworkAdapter(platformSfapJwtResolver, modifySfapResourceRequest);
|
|
649
719
|
// LDS initialization logic, invoked directly by Aura component tests
|
|
650
720
|
function initializeLDS() {
|
|
651
721
|
const storeOptions = {
|
|
@@ -669,4 +739,4 @@ function ldsEngineCreator() {
|
|
|
669
739
|
}
|
|
670
740
|
|
|
671
741
|
export { ldsEngineCreator as default, initializeLDS };
|
|
672
|
-
// version: 1.
|
|
742
|
+
// version: 1.237.0-5cc894ce9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildJwtNetworkAdapter(): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JwtResolver } from '@luvio/jwt-manager';
|
|
2
|
+
import type { ModifyResourceRequestHook } from '@salesforce/lds-network-fetch-with-jwt';
|
|
3
|
+
export declare const SFAPController = "SalesforceApiPlatformController";
|
|
4
|
+
export declare const SFAPJwtMethod = "getSFAPLightningJwtService";
|
|
5
|
+
type ExtraInfo = {
|
|
6
|
+
baseUri: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Resolves Jwt token for SFAP by calling Aura action
|
|
10
|
+
* {@link JwtResolver} for platform SFAP
|
|
11
|
+
*/
|
|
12
|
+
export declare const platformSfapJwtResolver: JwtResolver<ExtraInfo>;
|
|
13
|
+
/**
|
|
14
|
+
* This hook is used to modify the resource request before it is sent to the server.
|
|
15
|
+
* SFAP uses extraInfo assocaiated JwtToken to update the baseUri for the resource request.
|
|
16
|
+
*
|
|
17
|
+
* @param resourceRequest
|
|
18
|
+
* @param jwtToken
|
|
19
|
+
* @returns resourceRequest with updated baseUri
|
|
20
|
+
*/
|
|
21
|
+
export declare const modifySfapResourceRequest: ModifyResourceRequestHook<unknown, ExtraInfo>;
|
|
22
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-aura",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.237.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Aura runtime",
|
|
6
6
|
"main": "dist/ldsEngineCreator.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"prepare": "yarn build",
|
|
29
|
-
"build": "rollup --config rollup.config.js",
|
|
29
|
+
"build": "rollup --bundleConfigAsCjs --config rollup.config.js",
|
|
30
30
|
"clean": "rm -rf dist",
|
|
31
31
|
"test:unit": "jest",
|
|
32
32
|
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest --runInBand",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"@salesforce/lds-bindings": "*",
|
|
41
41
|
"@salesforce/lds-instrumentation": "*",
|
|
42
42
|
"@salesforce/lds-network-aura": "*",
|
|
43
|
-
"@salesforce/lds-
|
|
43
|
+
"@salesforce/lds-network-fetch-with-jwt": "*"
|
|
44
44
|
},
|
|
45
45
|
"luvioBundlesize": [
|
|
46
46
|
{
|
|
47
47
|
"path": "./dist/ldsEngineCreator.js",
|
|
48
48
|
"maxSize": {
|
|
49
49
|
"none": "32 kB",
|
|
50
|
-
"min": "
|
|
51
|
-
"compressed": "
|
|
50
|
+
"min": "13 kB",
|
|
51
|
+
"compressed": "8 kB"
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
]
|