@salesforce/lds-adapters-apex 1.294.0 → 1.296.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/es/es2018/apex-service.js +11 -1
- package/dist/es/es2018/types/src/main.d.ts +2 -0
- package/dist/es/es2018/types/src/predictive-loading/index.d.ts +1 -0
- package/dist/es/es2018/types/src/predictive-loading/registry.d.ts +8 -0
- package/dist/es/es2018/types/src/sfdc.d.ts +1 -0
- package/package.json +5 -5
- package/sfdc/index.js +41 -3
|
@@ -629,4 +629,14 @@ function getSObjectValue(sObject, field) {
|
|
|
629
629
|
return ret;
|
|
630
630
|
}
|
|
631
631
|
|
|
632
|
-
|
|
632
|
+
const engineForPrefetcherMap = new Map();
|
|
633
|
+
function registerPrefetcher(luvio, prefetcher) {
|
|
634
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
635
|
+
if (engineForPrefetcherMap.has(luvio)) {
|
|
636
|
+
throw new Error('Environment error: Only one prefetcher per engine is allowed.');
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
engineForPrefetcherMap.set(luvio, prefetcher);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export { getInvoker as GetApexInvoker, factory as GetApexWireAdapterFactory, postInvoker as PostApexInvoker, getSObjectValue, registerPrefetcher };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { factory as GetApexWireAdapterFactory } from './wire/getApex';
|
|
2
2
|
export { getInvoker as GetApexInvoker, postInvoker as PostApexInvoker } from './wire/postApex';
|
|
3
3
|
export { getSObjectValue } from './lds-apex-static-utils';
|
|
4
|
+
export { registerPrefetcher } from './predictive-loading';
|
|
5
|
+
export type { ApexInvokerParams } from './util/shared';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './registry';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Adapter, AdapterRequestContext, Luvio } from '@luvio/engine';
|
|
2
|
+
import type { ApexInvokerParams } from '../util/shared';
|
|
3
|
+
interface Prefetcher {
|
|
4
|
+
saveRequest: (request: any) => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare function registerPrefetcher(luvio: Luvio, prefetcher: Prefetcher): void;
|
|
7
|
+
export declare function createGetApexAdapterWithPrediction<C, D>(adapter: Adapter<C, D>, luvio: Luvio, invokerParams: ApexInvokerParams, name: string): (config: C, requestContext?: AdapterRequestContext) => import("@luvio/engine").Snapshot<D> | Promise<import("@luvio/engine").Snapshot<D>> | null;
|
|
8
|
+
export {};
|
|
@@ -20,3 +20,4 @@ export declare const getApexInvoker_imperative: (namespace: string, classname: s
|
|
|
20
20
|
*/
|
|
21
21
|
export declare const getApexInvoker: (namespace: string, classname: string, method: string, isContinuation: boolean, isCacheable?: boolean) => any;
|
|
22
22
|
export { getSObjectValue } from './lds-apex-static-utils';
|
|
23
|
+
export { registerPrefetcher, type ApexInvokerParams, GetApexWireAdapterFactory } from './main';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-adapters-apex",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.296.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "Wire adapters for Apex",
|
|
6
6
|
"main": "dist/es/es2018/apex-service.js",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
]
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@salesforce/lds-bindings": "^1.
|
|
34
|
-
"@salesforce/lds-default-luvio": "^1.
|
|
33
|
+
"@salesforce/lds-bindings": "^1.296.0",
|
|
34
|
+
"@salesforce/lds-default-luvio": "^1.296.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@salesforce/lds-compiler-plugins": "^1.
|
|
38
|
-
"@salesforce/lds-karma": "^1.
|
|
37
|
+
"@salesforce/lds-compiler-plugins": "^1.296.0",
|
|
38
|
+
"@salesforce/lds-karma": "^1.296.0"
|
|
39
39
|
},
|
|
40
40
|
"nx": {
|
|
41
41
|
"targets": {
|
package/sfdc/index.js
CHANGED
|
@@ -585,6 +585,39 @@ function postApexAdapterFactory(luvio, namespace, classname, method, isContinuat
|
|
|
585
585
|
};
|
|
586
586
|
}
|
|
587
587
|
|
|
588
|
+
const engineForPrefetcherMap = new Map();
|
|
589
|
+
function registerPrefetcher(luvio, prefetcher) {
|
|
590
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
591
|
+
if (engineForPrefetcherMap.has(luvio)) {
|
|
592
|
+
throw new Error('Environment error: Only one prefetcher per engine is allowed.');
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
engineForPrefetcherMap.set(luvio, prefetcher);
|
|
596
|
+
}
|
|
597
|
+
function getPrefetcherFor(luvio) {
|
|
598
|
+
return engineForPrefetcherMap.get(luvio);
|
|
599
|
+
}
|
|
600
|
+
function createGetApexAdapterWithPrediction(adapter, luvio, invokerParams, name) {
|
|
601
|
+
return (config, requestContext) => {
|
|
602
|
+
const prefetcher = getPrefetcherFor(luvio);
|
|
603
|
+
const result = adapter(config, requestContext);
|
|
604
|
+
// only save requests with a valid config.
|
|
605
|
+
if (result !== null &&
|
|
606
|
+
prefetcher !== undefined &&
|
|
607
|
+
!(requestContext && requestContext.excludeFromPredictions)) {
|
|
608
|
+
prefetcher.saveRequest({
|
|
609
|
+
adapterName: 'getApex',
|
|
610
|
+
config: {
|
|
611
|
+
name,
|
|
612
|
+
invokerParams,
|
|
613
|
+
config,
|
|
614
|
+
},
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
return result;
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
|
|
588
621
|
const REFRESH_APEX_KEY = 'refreshApex';
|
|
589
622
|
// export for @salesforce/apex
|
|
590
623
|
const refreshApex = function (data) {
|
|
@@ -643,9 +676,14 @@ const getApexInvoker = function (namespace, classname, method, isContinuation, i
|
|
|
643
676
|
method,
|
|
644
677
|
isContinuation,
|
|
645
678
|
}));
|
|
646
|
-
invokeApexImperative.adapter = createWireAdapterConstructor(luvio, createInstrumentedAdapter(createLDSAdapter(luvio, adapterName, (luvio) => factory(luvio, {
|
|
679
|
+
invokeApexImperative.adapter = createWireAdapterConstructor(luvio, createInstrumentedAdapter(createGetApexAdapterWithPrediction(createLDSAdapter(luvio, adapterName, (luvio) => factory(luvio, {
|
|
680
|
+
namespace,
|
|
681
|
+
classname,
|
|
682
|
+
method,
|
|
683
|
+
isContinuation,
|
|
684
|
+
})), luvio, { namespace, classname, method, isContinuation }, adapterName), adapterMetadata), adapterMetadata);
|
|
647
685
|
return invokeApexImperative;
|
|
648
686
|
};
|
|
649
687
|
|
|
650
|
-
export { getApexInvoker, getApexInvoker_imperative, refreshApex };
|
|
651
|
-
// version: 1.
|
|
688
|
+
export { factory as GetApexWireAdapterFactory, getApexInvoker, getApexInvoker_imperative, refreshApex, registerPrefetcher };
|
|
689
|
+
// version: 1.296.0-b5e933418
|