@salesforce/lds-bindings 1.354.0-dev1 → 1.354.0-dev10
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/ldsBindings.js +69 -5
- package/dist/types/wireAdapter.d.ts +1 -1
- package/package.json +5 -2
package/dist/ldsBindings.js
CHANGED
|
@@ -372,7 +372,58 @@ function createWireAdapterConstructor$1(adapter, name, luvio) {
|
|
|
372
372
|
return constructor;
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Simple deep equality comparison for configuration objects.
|
|
377
|
+
* Handles primitives, arrays, and plain objects.
|
|
378
|
+
*/
|
|
379
|
+
function deepEquals(a, b) {
|
|
380
|
+
if (a === b) {
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
if (a === null || a === undefined || b === null || b === undefined) {
|
|
384
|
+
return a === b;
|
|
385
|
+
}
|
|
386
|
+
if (typeof a !== typeof b) {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
if (typeof a !== 'object') {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
if (Array.isArray(a) !== Array.isArray(b)) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
396
|
+
if (a.length !== b.length) {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
for (let i = 0; i < a.length; i++) {
|
|
400
|
+
if (!deepEquals(a[i], b[i])) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return true;
|
|
405
|
+
}
|
|
406
|
+
// Handle plain objects
|
|
407
|
+
const aKeys = Object.keys(a);
|
|
408
|
+
const bKeys = Object.keys(b);
|
|
409
|
+
if (aKeys.length !== bKeys.length) {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
for (const key of aKeys) {
|
|
413
|
+
if (!bKeys.includes(key)) {
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
if (!deepEquals(a[key], b[key])) {
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return true;
|
|
421
|
+
}
|
|
375
422
|
class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
|
|
423
|
+
constructor(adapter, name, luvio, callback, sourceContext, paginationConfigParamNames) {
|
|
424
|
+
super(adapter, name, luvio, callback, sourceContext);
|
|
425
|
+
this.paginationConfigParamNames = paginationConfigParamNames;
|
|
426
|
+
}
|
|
376
427
|
/**
|
|
377
428
|
* Called when the component associated with the wire adapter is connected.
|
|
378
429
|
*/
|
|
@@ -395,6 +446,19 @@ class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
|
|
|
395
446
|
*/
|
|
396
447
|
update(config, context) {
|
|
397
448
|
if (this.connectTimestamp) {
|
|
449
|
+
// compare the incoming config with the current config.
|
|
450
|
+
// if any non-pagination config params have changed, we need to reset the connectTimestamp
|
|
451
|
+
const currentConfig = this.config;
|
|
452
|
+
// Check if any non-pagination parameters have changed
|
|
453
|
+
const hasNonPaginationParamChanged = Object.keys(config).some((paramName) => {
|
|
454
|
+
var _a;
|
|
455
|
+
// If this is not a pagination param and its value has changed
|
|
456
|
+
return (!((_a = this.paginationConfigParamNames) === null || _a === void 0 ? void 0 : _a.includes(paramName)) &&
|
|
457
|
+
!deepEquals(config[paramName], currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig[paramName]));
|
|
458
|
+
});
|
|
459
|
+
if (hasNonPaginationParamChanged) {
|
|
460
|
+
this.connectTimestamp = Date.now();
|
|
461
|
+
}
|
|
398
462
|
const adapterRequestContext = this.generateAdapterRequestContext(context);
|
|
399
463
|
super.unsubscribe();
|
|
400
464
|
this.config = sanitize(config);
|
|
@@ -430,9 +494,9 @@ class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
|
|
|
430
494
|
}
|
|
431
495
|
}
|
|
432
496
|
}
|
|
433
|
-
function createInfiniteScrollingWireAdapterConstructor$1(adapter, name, luvio) {
|
|
497
|
+
function createInfiniteScrollingWireAdapterConstructor$1(adapter, name, luvio, paginationConfigParamNames) {
|
|
434
498
|
const constructor = function (callback, sourceContext) {
|
|
435
|
-
const delegate = new LWCInfinteScrollingLuvioWireAdapter(adapter, name, luvio, callback, sourceContext);
|
|
499
|
+
const delegate = new LWCInfinteScrollingLuvioWireAdapter(adapter, name, luvio, callback, sourceContext, paginationConfigParamNames);
|
|
436
500
|
this.connect = () => delegate.connect();
|
|
437
501
|
this.disconnect = () => delegate.disconnect();
|
|
438
502
|
this.update = (config, context) => delegate.update(config, context);
|
|
@@ -945,9 +1009,9 @@ function createWireAdapterConstructor(luvio, adapter, metadata) {
|
|
|
945
1009
|
const { apiFamily, name } = metadata;
|
|
946
1010
|
return createWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio);
|
|
947
1011
|
}
|
|
948
|
-
function createInfiniteScrollingWireAdapterConstructor(luvio, adapter, metadata) {
|
|
1012
|
+
function createInfiniteScrollingWireAdapterConstructor(luvio, adapter, metadata, paginationConfigParamNames) {
|
|
949
1013
|
const { apiFamily, name } = metadata;
|
|
950
|
-
return createInfiniteScrollingWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio);
|
|
1014
|
+
return createInfiniteScrollingWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, paginationConfigParamNames);
|
|
951
1015
|
}
|
|
952
1016
|
function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolver) {
|
|
953
1017
|
const { apiFamily, name } = metadata;
|
|
@@ -955,4 +1019,4 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
955
1019
|
}
|
|
956
1020
|
|
|
957
1021
|
export { ADAPTER_UNFULFILLED_ERROR, REFRESH_ADAPTER_EVENT, bindWireRefresh, createGraphQLImperativeAdapter, createGraphQLWireAdapterConstructor, createImperativeAdapter, createInfiniteScrollingWireAdapterConstructor, createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, instrument, refresh };
|
|
958
|
-
// version: 1.354.0-
|
|
1022
|
+
// version: 1.354.0-dev10-8ec1b0bbbe
|
|
@@ -3,5 +3,5 @@ import type { WireAdapterConstructor } from '@lwc/engine-core';
|
|
|
3
3
|
import type { AdapterMetadata } from './ldsAdapter';
|
|
4
4
|
import type { AstResolver } from '@luvio/graphql-parser';
|
|
5
5
|
export declare function createWireAdapterConstructor<C, D>(luvio: Luvio, adapter: Adapter<C, D>, metadata: AdapterMetadata): WireAdapterConstructor;
|
|
6
|
-
export declare function createInfiniteScrollingWireAdapterConstructor<C, D>(luvio: Luvio, adapter: Adapter<C, D>, metadata: AdapterMetadata): WireAdapterConstructor;
|
|
6
|
+
export declare function createInfiniteScrollingWireAdapterConstructor<C, D>(luvio: Luvio, adapter: Adapter<C, D>, metadata: AdapterMetadata, paginationConfigParamNames?: string[]): WireAdapterConstructor;
|
|
7
7
|
export declare function createGraphQLWireAdapterConstructor<C, D>(luvio: Luvio, adapter: Adapter<C, D>, metadata: AdapterMetadata, astResolver: AstResolver): WireAdapterConstructor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-bindings",
|
|
3
|
-
"version": "1.354.0-
|
|
3
|
+
"version": "1.354.0-dev10",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS Bindings for SFDC",
|
|
6
6
|
"main": "dist/ldsBindings.js",
|
|
@@ -31,9 +31,12 @@
|
|
|
31
31
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-bindings"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@salesforce/lds-graphql-parser": "^1.354.0-
|
|
34
|
+
"@salesforce/lds-graphql-parser": "^1.354.0-dev10"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@lwc/engine-core": "2.42.0"
|
|
38
|
+
},
|
|
39
|
+
"volta": {
|
|
40
|
+
"extends": "../../package.json"
|
|
38
41
|
}
|
|
39
42
|
}
|