@luvio/lwc-luvio 0.63.3 → 0.67.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.
@@ -1,6 +1,26 @@
1
1
  import { Adapter, Luvio } from '@luvio/engine';
2
- import { WireAdapterConstructor } from '@lwc/engine-core';
2
+ import { WireConfigValue, WireContextValue, WireAdapterConstructor } from '@lwc/engine-core';
3
3
  import { LWCLuvioWireAdapter } from './LWCLuvioWireAdapter';
4
4
  export declare class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
5
+ private connectTimestamp?;
6
+ /**
7
+ * Called when the component associated with the wire adapter is connected.
8
+ */
9
+ connect(): void;
10
+ /**
11
+ * Called when the component associated with the wire adapter is disconnected.
12
+ */
13
+ disconnect(): void;
14
+ /**
15
+ * Called when new or updated config is supplied to the wire adapter.
16
+ *
17
+ * @param config new config parameters for the wire adapter
18
+ * @param context context for the wire adapter
19
+ */
20
+ update(config: WireConfigValue, context?: WireContextValue): void;
21
+ /**
22
+ * Calls the adapter if config has been set and the component is connected.
23
+ */
24
+ private callAdapterWithContext;
5
25
  }
6
26
  export declare function createInfiniteScrollingWireAdapterConstructor(adapter: Adapter<unknown, unknown>, name: string, luvio: Luvio): WireAdapterConstructor;
@@ -33,6 +33,7 @@ export declare class LWCLuvioWireAdapter implements WireAdapter {
33
33
  * Calls the adapter if config has been set and the component is connected.
34
34
  */
35
35
  private callAdapter;
36
+ protected processAdapterResponse(snapshotOrPromise: ReturnType<Adapter<unknown, unknown>>): void;
36
37
  /**
37
38
  * Emits new values to the callback.
38
39
  *
@@ -50,7 +51,7 @@ export declare class LWCLuvioWireAdapter implements WireAdapter {
50
51
  /**
51
52
  * Deletes this wire adapter's snapshot subscription (if any).
52
53
  */
53
- private unsubscribe;
54
+ protected unsubscribe(): void;
54
55
  }
55
56
  /**
56
57
  * Wraps a luvio Adapter in a WireAdapterConstructor that conforms to https://rfcs.lwc.dev/rfcs/lwc/0000-wire-reform#wire-adapter-protocol.
@@ -219,7 +219,7 @@ class LWCLuvioWireAdapter {
219
219
  this.config = sanitize(config);
220
220
  this.callAdapter();
221
221
  }
222
- // private utility methods
222
+ // private and protected utility methods
223
223
  /**
224
224
  * Calls the adapter if config has been set and the component is connected.
225
225
  */
@@ -228,6 +228,9 @@ class LWCLuvioWireAdapter {
228
228
  return;
229
229
  }
230
230
  const snapshotOrPromise = this.adapter(this.config);
231
+ this.processAdapterResponse(snapshotOrPromise);
232
+ }
233
+ processAdapterResponse(snapshotOrPromise) {
231
234
  // insufficient config, wait for new config from component
232
235
  if (snapshotOrPromise === null) {
233
236
  return;
@@ -344,6 +347,52 @@ function createWireAdapterConstructor(adapter, name, luvio) {
344
347
  }
345
348
 
346
349
  class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
350
+ /**
351
+ * Called when the component associated with the wire adapter is connected.
352
+ */
353
+ connect() {
354
+ this.connectTimestamp = Date.now();
355
+ super.connect();
356
+ }
357
+ /**
358
+ * Called when the component associated with the wire adapter is disconnected.
359
+ */
360
+ disconnect() {
361
+ this.connectTimestamp = undefined;
362
+ super.disconnect();
363
+ }
364
+ /**
365
+ * Called when new or updated config is supplied to the wire adapter.
366
+ *
367
+ * @param config new config parameters for the wire adapter
368
+ * @param context context for the wire adapter
369
+ */
370
+ update(config, context) {
371
+ if (this.connectTimestamp) {
372
+ const mergedContext = Object.assign({
373
+ cachePolicy: {
374
+ type: 'valid-at',
375
+ timestamp: this.connectTimestamp,
376
+ },
377
+ }, context);
378
+ super.unsubscribe();
379
+ this.config = sanitize(config);
380
+ this.callAdapterWithContext(mergedContext);
381
+ }
382
+ else {
383
+ super.update(config, context);
384
+ }
385
+ }
386
+ /**
387
+ * Calls the adapter if config has been set and the component is connected.
388
+ */
389
+ callAdapterWithContext(context) {
390
+ if (!this.connected || this.config === undefined) {
391
+ return;
392
+ }
393
+ const snapshotOrPromise = this.adapter(this.config, context);
394
+ super.processAdapterResponse(snapshotOrPromise);
395
+ }
347
396
  }
348
397
  function createInfiniteScrollingWireAdapterConstructor(adapter, name, luvio) {
349
398
  const constructor = function (callback) {
@@ -1,6 +1,26 @@
1
1
  import { Adapter, Luvio } from '@luvio/engine';
2
- import { WireAdapterConstructor } from '@lwc/engine-core';
2
+ import { WireConfigValue, WireContextValue, WireAdapterConstructor } from '@lwc/engine-core';
3
3
  import { LWCLuvioWireAdapter } from './LWCLuvioWireAdapter';
4
4
  export declare class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
5
+ private connectTimestamp?;
6
+ /**
7
+ * Called when the component associated with the wire adapter is connected.
8
+ */
9
+ connect(): void;
10
+ /**
11
+ * Called when the component associated with the wire adapter is disconnected.
12
+ */
13
+ disconnect(): void;
14
+ /**
15
+ * Called when new or updated config is supplied to the wire adapter.
16
+ *
17
+ * @param config new config parameters for the wire adapter
18
+ * @param context context for the wire adapter
19
+ */
20
+ update(config: WireConfigValue, context?: WireContextValue): void;
21
+ /**
22
+ * Calls the adapter if config has been set and the component is connected.
23
+ */
24
+ private callAdapterWithContext;
5
25
  }
6
26
  export declare function createInfiniteScrollingWireAdapterConstructor(adapter: Adapter<unknown, unknown>, name: string, luvio: Luvio): WireAdapterConstructor;
@@ -33,6 +33,7 @@ export declare class LWCLuvioWireAdapter implements WireAdapter {
33
33
  * Calls the adapter if config has been set and the component is connected.
34
34
  */
35
35
  private callAdapter;
36
+ protected processAdapterResponse(snapshotOrPromise: ReturnType<Adapter<unknown, unknown>>): void;
36
37
  /**
37
38
  * Emits new values to the callback.
38
39
  *
@@ -50,7 +51,7 @@ export declare class LWCLuvioWireAdapter implements WireAdapter {
50
51
  /**
51
52
  * Deletes this wire adapter's snapshot subscription (if any).
52
53
  */
53
- private unsubscribe;
54
+ protected unsubscribe(): void;
54
55
  }
55
56
  /**
56
57
  * Wraps a luvio Adapter in a WireAdapterConstructor that conforms to https://rfcs.lwc.dev/rfcs/lwc/0000-wire-reform#wire-adapter-protocol.
@@ -223,7 +223,7 @@
223
223
  this.config = sanitize(config);
224
224
  this.callAdapter();
225
225
  }
226
- // private utility methods
226
+ // private and protected utility methods
227
227
  /**
228
228
  * Calls the adapter if config has been set and the component is connected.
229
229
  */
@@ -232,6 +232,9 @@
232
232
  return;
233
233
  }
234
234
  const snapshotOrPromise = this.adapter(this.config);
235
+ this.processAdapterResponse(snapshotOrPromise);
236
+ }
237
+ processAdapterResponse(snapshotOrPromise) {
235
238
  // insufficient config, wait for new config from component
236
239
  if (snapshotOrPromise === null) {
237
240
  return;
@@ -348,6 +351,52 @@
348
351
  }
349
352
 
350
353
  class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
354
+ /**
355
+ * Called when the component associated with the wire adapter is connected.
356
+ */
357
+ connect() {
358
+ this.connectTimestamp = Date.now();
359
+ super.connect();
360
+ }
361
+ /**
362
+ * Called when the component associated with the wire adapter is disconnected.
363
+ */
364
+ disconnect() {
365
+ this.connectTimestamp = undefined;
366
+ super.disconnect();
367
+ }
368
+ /**
369
+ * Called when new or updated config is supplied to the wire adapter.
370
+ *
371
+ * @param config new config parameters for the wire adapter
372
+ * @param context context for the wire adapter
373
+ */
374
+ update(config, context) {
375
+ if (this.connectTimestamp) {
376
+ const mergedContext = Object.assign({
377
+ cachePolicy: {
378
+ type: 'valid-at',
379
+ timestamp: this.connectTimestamp,
380
+ },
381
+ }, context);
382
+ super.unsubscribe();
383
+ this.config = sanitize(config);
384
+ this.callAdapterWithContext(mergedContext);
385
+ }
386
+ else {
387
+ super.update(config, context);
388
+ }
389
+ }
390
+ /**
391
+ * Calls the adapter if config has been set and the component is connected.
392
+ */
393
+ callAdapterWithContext(context) {
394
+ if (!this.connected || this.config === undefined) {
395
+ return;
396
+ }
397
+ const snapshotOrPromise = this.adapter(this.config, context);
398
+ super.processAdapterResponse(snapshotOrPromise);
399
+ }
351
400
  }
352
401
  function createInfiniteScrollingWireAdapterConstructor(adapter, name, luvio) {
353
402
  const constructor = function (callback) {
@@ -1,6 +1,26 @@
1
1
  import { Adapter, Luvio } from '@luvio/engine';
2
- import { WireAdapterConstructor } from '@lwc/engine-core';
2
+ import { WireConfigValue, WireContextValue, WireAdapterConstructor } from '@lwc/engine-core';
3
3
  import { LWCLuvioWireAdapter } from './LWCLuvioWireAdapter';
4
4
  export declare class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
5
+ private connectTimestamp?;
6
+ /**
7
+ * Called when the component associated with the wire adapter is connected.
8
+ */
9
+ connect(): void;
10
+ /**
11
+ * Called when the component associated with the wire adapter is disconnected.
12
+ */
13
+ disconnect(): void;
14
+ /**
15
+ * Called when new or updated config is supplied to the wire adapter.
16
+ *
17
+ * @param config new config parameters for the wire adapter
18
+ * @param context context for the wire adapter
19
+ */
20
+ update(config: WireConfigValue, context?: WireContextValue): void;
21
+ /**
22
+ * Calls the adapter if config has been set and the component is connected.
23
+ */
24
+ private callAdapterWithContext;
5
25
  }
6
26
  export declare function createInfiniteScrollingWireAdapterConstructor(adapter: Adapter<unknown, unknown>, name: string, luvio: Luvio): WireAdapterConstructor;
@@ -33,6 +33,7 @@ export declare class LWCLuvioWireAdapter implements WireAdapter {
33
33
  * Calls the adapter if config has been set and the component is connected.
34
34
  */
35
35
  private callAdapter;
36
+ protected processAdapterResponse(snapshotOrPromise: ReturnType<Adapter<unknown, unknown>>): void;
36
37
  /**
37
38
  * Emits new values to the callback.
38
39
  *
@@ -50,7 +51,7 @@ export declare class LWCLuvioWireAdapter implements WireAdapter {
50
51
  /**
51
52
  * Deletes this wire adapter's snapshot subscription (if any).
52
53
  */
53
- private unsubscribe;
54
+ protected unsubscribe(): void;
54
55
  }
55
56
  /**
56
57
  * Wraps a luvio Adapter in a WireAdapterConstructor that conforms to https://rfcs.lwc.dev/rfcs/lwc/0000-wire-reform#wire-adapter-protocol.
@@ -225,16 +225,19 @@
225
225
  this.config = sanitize(config);
226
226
  this.callAdapter();
227
227
  };
228
- // private utility methods
228
+ // private and protected utility methods
229
229
  /**
230
230
  * Calls the adapter if config has been set and the component is connected.
231
231
  */
232
232
  LWCLuvioWireAdapter.prototype.callAdapter = function () {
233
- var _this = this;
234
233
  if (!this.connected || this.config === undefined) {
235
234
  return;
236
235
  }
237
236
  var snapshotOrPromise = this.adapter(this.config);
237
+ this.processAdapterResponse(snapshotOrPromise);
238
+ };
239
+ LWCLuvioWireAdapter.prototype.processAdapterResponse = function (snapshotOrPromise) {
240
+ var _this = this;
238
241
  // insufficient config, wait for new config from component
239
242
  if (snapshotOrPromise === null) {
240
243
  return;
@@ -392,6 +395,52 @@
392
395
  function LWCInfinteScrollingLuvioWireAdapter() {
393
396
  return _super !== null && _super.apply(this, arguments) || this;
394
397
  }
398
+ /**
399
+ * Called when the component associated with the wire adapter is connected.
400
+ */
401
+ LWCInfinteScrollingLuvioWireAdapter.prototype.connect = function () {
402
+ this.connectTimestamp = Date.now();
403
+ _super.prototype.connect.call(this);
404
+ };
405
+ /**
406
+ * Called when the component associated with the wire adapter is disconnected.
407
+ */
408
+ LWCInfinteScrollingLuvioWireAdapter.prototype.disconnect = function () {
409
+ this.connectTimestamp = undefined;
410
+ _super.prototype.disconnect.call(this);
411
+ };
412
+ /**
413
+ * Called when new or updated config is supplied to the wire adapter.
414
+ *
415
+ * @param config new config parameters for the wire adapter
416
+ * @param context context for the wire adapter
417
+ */
418
+ LWCInfinteScrollingLuvioWireAdapter.prototype.update = function (config, context) {
419
+ if (this.connectTimestamp) {
420
+ var mergedContext = Object.assign({
421
+ cachePolicy: {
422
+ type: 'valid-at',
423
+ timestamp: this.connectTimestamp,
424
+ },
425
+ }, context);
426
+ _super.prototype.unsubscribe.call(this);
427
+ this.config = sanitize(config);
428
+ this.callAdapterWithContext(mergedContext);
429
+ }
430
+ else {
431
+ _super.prototype.update.call(this, config, context);
432
+ }
433
+ };
434
+ /**
435
+ * Calls the adapter if config has been set and the component is connected.
436
+ */
437
+ LWCInfinteScrollingLuvioWireAdapter.prototype.callAdapterWithContext = function (context) {
438
+ if (!this.connected || this.config === undefined) {
439
+ return;
440
+ }
441
+ var snapshotOrPromise = this.adapter(this.config, context);
442
+ _super.prototype.processAdapterResponse.call(this, snapshotOrPromise);
443
+ };
395
444
  return LWCInfinteScrollingLuvioWireAdapter;
396
445
  }(LWCLuvioWireAdapter));
397
446
  function createInfiniteScrollingWireAdapterConstructor(adapter, name, luvio) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/lwc-luvio",
3
- "version": "0.63.3",
3
+ "version": "0.67.0",
4
4
  "description": "Lightning Web Component bindings for Luvio",
5
5
  "main": "dist/umd/es2018/lwcluvio.js",
6
6
  "module": "dist/es/es2018/lwcluvio.js",
@@ -14,16 +14,30 @@
14
14
  "watch": "yarn build --watch",
15
15
  "test": "jest"
16
16
  },
17
+ "nx": {
18
+ "targets": {
19
+ "build": {
20
+ "outputs": [
21
+ "packages/@luvio/lwc-luvio/dist"
22
+ ]
23
+ },
24
+ "test": {
25
+ "outputs": [
26
+ "packages/@luvio/lwc-luvio/src/__tests__/components/generated"
27
+ ]
28
+ }
29
+ }
30
+ },
17
31
  "files": [
18
32
  "dist/"
19
33
  ],
20
34
  "devDependencies": {
21
- "@luvio/adapter-test-library": "0.63.3",
22
- "@luvio/cli": "0.63.3",
35
+ "@luvio/adapter-test-library": "0.67.0",
36
+ "@luvio/cli": "0.67.0",
23
37
  "@lwc/jest-preset": "11.2.2"
24
38
  },
25
39
  "dependencies": {
26
- "@luvio/engine": "0.63.3",
40
+ "@luvio/engine": "0.67.0",
27
41
  "@lwc/engine-core": "^2.5.10"
28
42
  }
29
43
  }