@luvio/lwc-luvio 0.126.1 → 0.126.2
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/LWCGraphQLLuvioWireAdapter.d.ts +12 -4
- package/dist/es/es2018/lwcluvio.js +57 -21
- package/dist/umd/es2018/LWCGraphQLLuvioWireAdapter.d.ts +12 -4
- package/dist/umd/es2018/lwcluvio.js +57 -21
- package/dist/umd/es5/LWCGraphQLLuvioWireAdapter.d.ts +12 -4
- package/dist/umd/es5/lwcluvio.js +57 -16
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Adapter, Luvio } from '@luvio/engine';
|
|
2
2
|
import type { WireConfigValue, WireContextValue, DataCallback, WireAdapterConstructor } from '@lwc/engine-core';
|
|
3
|
-
import type { AstResolver } from '@luvio/graphql-parser';
|
|
3
|
+
import type { AstResolver, DocumentNode } from '@luvio/graphql-parser';
|
|
4
4
|
import { LWCLuvioWireAdapter } from './LWCLuvioWireAdapter';
|
|
5
5
|
import type { EmittableSnapshot } from './utils/SnapshotState';
|
|
6
6
|
export declare type GraphQLError = {
|
|
@@ -12,11 +12,18 @@ export declare type GraphQLError = {
|
|
|
12
12
|
path?: Array<string | number>;
|
|
13
13
|
extensions?: Record<string, any>;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
query
|
|
15
|
+
export interface GraphQLUserInput {
|
|
16
|
+
query?: object;
|
|
17
17
|
variables?: Record<string, string | number | boolean>;
|
|
18
18
|
operationName?: string;
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
|
+
export interface ResolvedGraphQLConfig extends GraphQLUserInput {
|
|
21
|
+
query?: DocumentNode;
|
|
22
|
+
}
|
|
23
|
+
export interface GraphQLBatchUserInput {
|
|
24
|
+
batchQuery: [GraphQLUserInput];
|
|
25
|
+
}
|
|
26
|
+
export declare type GraphQLInput = GraphQLUserInput | GraphQLBatchUserInput;
|
|
20
27
|
export declare type GraphQLResponse = {
|
|
21
28
|
data: any;
|
|
22
29
|
errors?: GraphQLError[];
|
|
@@ -37,6 +44,7 @@ export declare class LWCGraphQLLuvioWireAdapter extends LWCLuvioWireAdapter {
|
|
|
37
44
|
* Coerce config before calling the adapter, preserve current behavior otherwise
|
|
38
45
|
*/
|
|
39
46
|
protected callAdapter(): void;
|
|
47
|
+
resolveQueryAst(config: GraphQLUserInput): ResolvedGraphQLConfig | undefined;
|
|
40
48
|
}
|
|
41
49
|
/**
|
|
42
50
|
* Wraps a luvio Adapter in a WireAdapterConstructor that conforms to https://rfcs.lwc.dev/rfcs/lwc/0000-wire-reform#wire-adapter-protocol.
|
|
@@ -414,12 +414,8 @@ function snapshotToPayload(snapshot) {
|
|
|
414
414
|
if (snapshot === undefined) {
|
|
415
415
|
return payload;
|
|
416
416
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
'data' in snapshot.data &&
|
|
420
|
-
snapshot.data.data !== undefined) {
|
|
421
|
-
payload.data = snapshot.data.data;
|
|
422
|
-
}
|
|
417
|
+
payload.data = extractSnapshotData(snapshot);
|
|
418
|
+
// TODO handle batch error scenarios.
|
|
423
419
|
if ('error' in snapshot && snapshot.error !== undefined) {
|
|
424
420
|
if (Array.isArray(snapshot.error)) {
|
|
425
421
|
payload.errors = snapshot.error;
|
|
@@ -437,12 +433,14 @@ class LWCGraphQLLuvioWireAdapter extends LWCLuvioWireAdapter {
|
|
|
437
433
|
}
|
|
438
434
|
update(config, _context) {
|
|
439
435
|
this.unsubscribe();
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
436
|
+
if (config.batchQuery) {
|
|
437
|
+
this.config = {
|
|
438
|
+
batchQuery: config.batchQuery.map((individualConfig) => safeSanitizeGraphQLConfigObject(individualConfig)),
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
this.config = safeSanitizeGraphQLConfigObject(config);
|
|
443
|
+
}
|
|
446
444
|
this.callAdapter();
|
|
447
445
|
}
|
|
448
446
|
/**
|
|
@@ -469,24 +467,53 @@ class LWCGraphQLLuvioWireAdapter extends LWCLuvioWireAdapter {
|
|
|
469
467
|
if (!this.connected || this.config === undefined) {
|
|
470
468
|
return;
|
|
471
469
|
}
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
470
|
+
const config = this.config;
|
|
471
|
+
if ('batchQuery' in config) {
|
|
472
|
+
const batchConfig = {
|
|
473
|
+
batchQuery: config.batchQuery.map((individualConfig) => this.resolveQueryAst(individualConfig)),
|
|
474
|
+
};
|
|
475
|
+
// If any of the configurations are invalid, we bail out of calling the adapter.
|
|
476
|
+
if (batchConfig.batchQuery.some((val) => val === undefined)) {
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
const snapshotOrPromise = this.adapter(batchConfig);
|
|
480
|
+
this.processAdapterResponse(snapshotOrPromise);
|
|
481
|
+
}
|
|
482
|
+
else if ('query' in config) {
|
|
483
|
+
const singleConfig = this.resolveQueryAst(config);
|
|
484
|
+
if (singleConfig !== undefined) {
|
|
485
|
+
const snapshotOrPromise = this.adapter(singleConfig);
|
|
486
|
+
this.processAdapterResponse(snapshotOrPromise);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
resolveQueryAst(config) {
|
|
491
|
+
if (config.query === null) {
|
|
475
492
|
return;
|
|
476
493
|
}
|
|
477
|
-
const ast = this.astResolver(query);
|
|
478
|
-
if (ast === undefined && query !== undefined) {
|
|
494
|
+
const ast = this.astResolver(config.query);
|
|
495
|
+
if (ast === undefined && config.query !== undefined) {
|
|
479
496
|
// this should only happen if the user didn't parse the query
|
|
480
497
|
if (process.env.NODE_ENV !== 'production') {
|
|
481
498
|
throw new Error(USERLAND_GRAPHQL_PARSER_ERROR_MESSAGE);
|
|
482
499
|
}
|
|
483
500
|
return;
|
|
484
501
|
}
|
|
485
|
-
const
|
|
486
|
-
...
|
|
502
|
+
const resolvedAdapterConfig = {
|
|
503
|
+
...config,
|
|
487
504
|
query: ast,
|
|
488
|
-
}
|
|
489
|
-
|
|
505
|
+
};
|
|
506
|
+
return resolvedAdapterConfig;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function extractSnapshotData(snapshot) {
|
|
510
|
+
if ('data' in snapshot && snapshot.data !== undefined) {
|
|
511
|
+
const isSingleGraphQLData = 'data' in snapshot.data && snapshot.data.data !== undefined;
|
|
512
|
+
const isBatchGraphQLData = 'results' in snapshot.data && snapshot.data.results !== undefined;
|
|
513
|
+
if (isSingleGraphQLData)
|
|
514
|
+
return snapshot.data.data;
|
|
515
|
+
if (isBatchGraphQLData)
|
|
516
|
+
return snapshot.data;
|
|
490
517
|
}
|
|
491
518
|
}
|
|
492
519
|
/**
|
|
@@ -505,6 +532,15 @@ function createGraphQLWireAdapterConstructor(adapter, name, luvio, astResolver)
|
|
|
505
532
|
};
|
|
506
533
|
Object.defineProperty(constructor, 'name', { value: name });
|
|
507
534
|
return constructor;
|
|
535
|
+
}
|
|
536
|
+
function safeSanitizeGraphQLConfigObject(config) {
|
|
537
|
+
// graphql query AST is passed by reference
|
|
538
|
+
// sanitizing it makes a copy and we lose that reference
|
|
539
|
+
// so we avoid sanitizing it
|
|
540
|
+
return {
|
|
541
|
+
...sanitize(config),
|
|
542
|
+
query: config.query,
|
|
543
|
+
};
|
|
508
544
|
}
|
|
509
545
|
|
|
510
546
|
export { ADAPTER_UNFULFILLED_ERROR, REFRESH_ADAPTER_EVENT, bindWireRefresh, createGraphQLWireAdapterConstructor, createInfiniteScrollingWireAdapterConstructor, createWireAdapterConstructor, refreshData };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Adapter, Luvio } from '@luvio/engine';
|
|
2
2
|
import type { WireConfigValue, WireContextValue, DataCallback, WireAdapterConstructor } from '@lwc/engine-core';
|
|
3
|
-
import type { AstResolver } from '@luvio/graphql-parser';
|
|
3
|
+
import type { AstResolver, DocumentNode } from '@luvio/graphql-parser';
|
|
4
4
|
import { LWCLuvioWireAdapter } from './LWCLuvioWireAdapter';
|
|
5
5
|
import type { EmittableSnapshot } from './utils/SnapshotState';
|
|
6
6
|
export declare type GraphQLError = {
|
|
@@ -12,11 +12,18 @@ export declare type GraphQLError = {
|
|
|
12
12
|
path?: Array<string | number>;
|
|
13
13
|
extensions?: Record<string, any>;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
query
|
|
15
|
+
export interface GraphQLUserInput {
|
|
16
|
+
query?: object;
|
|
17
17
|
variables?: Record<string, string | number | boolean>;
|
|
18
18
|
operationName?: string;
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
|
+
export interface ResolvedGraphQLConfig extends GraphQLUserInput {
|
|
21
|
+
query?: DocumentNode;
|
|
22
|
+
}
|
|
23
|
+
export interface GraphQLBatchUserInput {
|
|
24
|
+
batchQuery: [GraphQLUserInput];
|
|
25
|
+
}
|
|
26
|
+
export declare type GraphQLInput = GraphQLUserInput | GraphQLBatchUserInput;
|
|
20
27
|
export declare type GraphQLResponse = {
|
|
21
28
|
data: any;
|
|
22
29
|
errors?: GraphQLError[];
|
|
@@ -37,6 +44,7 @@ export declare class LWCGraphQLLuvioWireAdapter extends LWCLuvioWireAdapter {
|
|
|
37
44
|
* Coerce config before calling the adapter, preserve current behavior otherwise
|
|
38
45
|
*/
|
|
39
46
|
protected callAdapter(): void;
|
|
47
|
+
resolveQueryAst(config: GraphQLUserInput): ResolvedGraphQLConfig | undefined;
|
|
40
48
|
}
|
|
41
49
|
/**
|
|
42
50
|
* Wraps a luvio Adapter in a WireAdapterConstructor that conforms to https://rfcs.lwc.dev/rfcs/lwc/0000-wire-reform#wire-adapter-protocol.
|
|
@@ -418,12 +418,8 @@
|
|
|
418
418
|
if (snapshot === undefined) {
|
|
419
419
|
return payload;
|
|
420
420
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
'data' in snapshot.data &&
|
|
424
|
-
snapshot.data.data !== undefined) {
|
|
425
|
-
payload.data = snapshot.data.data;
|
|
426
|
-
}
|
|
421
|
+
payload.data = extractSnapshotData(snapshot);
|
|
422
|
+
// TODO handle batch error scenarios.
|
|
427
423
|
if ('error' in snapshot && snapshot.error !== undefined) {
|
|
428
424
|
if (Array.isArray(snapshot.error)) {
|
|
429
425
|
payload.errors = snapshot.error;
|
|
@@ -441,12 +437,14 @@
|
|
|
441
437
|
}
|
|
442
438
|
update(config, _context) {
|
|
443
439
|
this.unsubscribe();
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
440
|
+
if (config.batchQuery) {
|
|
441
|
+
this.config = {
|
|
442
|
+
batchQuery: config.batchQuery.map((individualConfig) => safeSanitizeGraphQLConfigObject(individualConfig)),
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
this.config = safeSanitizeGraphQLConfigObject(config);
|
|
447
|
+
}
|
|
450
448
|
this.callAdapter();
|
|
451
449
|
}
|
|
452
450
|
/**
|
|
@@ -473,24 +471,53 @@
|
|
|
473
471
|
if (!this.connected || this.config === undefined) {
|
|
474
472
|
return;
|
|
475
473
|
}
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
-
|
|
474
|
+
const config = this.config;
|
|
475
|
+
if ('batchQuery' in config) {
|
|
476
|
+
const batchConfig = {
|
|
477
|
+
batchQuery: config.batchQuery.map((individualConfig) => this.resolveQueryAst(individualConfig)),
|
|
478
|
+
};
|
|
479
|
+
// If any of the configurations are invalid, we bail out of calling the adapter.
|
|
480
|
+
if (batchConfig.batchQuery.some((val) => val === undefined)) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
const snapshotOrPromise = this.adapter(batchConfig);
|
|
484
|
+
this.processAdapterResponse(snapshotOrPromise);
|
|
485
|
+
}
|
|
486
|
+
else if ('query' in config) {
|
|
487
|
+
const singleConfig = this.resolveQueryAst(config);
|
|
488
|
+
if (singleConfig !== undefined) {
|
|
489
|
+
const snapshotOrPromise = this.adapter(singleConfig);
|
|
490
|
+
this.processAdapterResponse(snapshotOrPromise);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
resolveQueryAst(config) {
|
|
495
|
+
if (config.query === null) {
|
|
479
496
|
return;
|
|
480
497
|
}
|
|
481
|
-
const ast = this.astResolver(query);
|
|
482
|
-
if (ast === undefined && query !== undefined) {
|
|
498
|
+
const ast = this.astResolver(config.query);
|
|
499
|
+
if (ast === undefined && config.query !== undefined) {
|
|
483
500
|
// this should only happen if the user didn't parse the query
|
|
484
501
|
if (process.env.NODE_ENV !== 'production') {
|
|
485
502
|
throw new Error(USERLAND_GRAPHQL_PARSER_ERROR_MESSAGE);
|
|
486
503
|
}
|
|
487
504
|
return;
|
|
488
505
|
}
|
|
489
|
-
const
|
|
490
|
-
...
|
|
506
|
+
const resolvedAdapterConfig = {
|
|
507
|
+
...config,
|
|
491
508
|
query: ast,
|
|
492
|
-
}
|
|
493
|
-
|
|
509
|
+
};
|
|
510
|
+
return resolvedAdapterConfig;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
function extractSnapshotData(snapshot) {
|
|
514
|
+
if ('data' in snapshot && snapshot.data !== undefined) {
|
|
515
|
+
const isSingleGraphQLData = 'data' in snapshot.data && snapshot.data.data !== undefined;
|
|
516
|
+
const isBatchGraphQLData = 'results' in snapshot.data && snapshot.data.results !== undefined;
|
|
517
|
+
if (isSingleGraphQLData)
|
|
518
|
+
return snapshot.data.data;
|
|
519
|
+
if (isBatchGraphQLData)
|
|
520
|
+
return snapshot.data;
|
|
494
521
|
}
|
|
495
522
|
}
|
|
496
523
|
/**
|
|
@@ -509,6 +536,15 @@
|
|
|
509
536
|
};
|
|
510
537
|
Object.defineProperty(constructor, 'name', { value: name });
|
|
511
538
|
return constructor;
|
|
539
|
+
}
|
|
540
|
+
function safeSanitizeGraphQLConfigObject(config) {
|
|
541
|
+
// graphql query AST is passed by reference
|
|
542
|
+
// sanitizing it makes a copy and we lose that reference
|
|
543
|
+
// so we avoid sanitizing it
|
|
544
|
+
return {
|
|
545
|
+
...sanitize(config),
|
|
546
|
+
query: config.query,
|
|
547
|
+
};
|
|
512
548
|
}
|
|
513
549
|
|
|
514
550
|
exports.ADAPTER_UNFULFILLED_ERROR = ADAPTER_UNFULFILLED_ERROR;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Adapter, Luvio } from '@luvio/engine';
|
|
2
2
|
import type { WireConfigValue, WireContextValue, DataCallback, WireAdapterConstructor } from '@lwc/engine-core';
|
|
3
|
-
import type { AstResolver } from '@luvio/graphql-parser';
|
|
3
|
+
import type { AstResolver, DocumentNode } from '@luvio/graphql-parser';
|
|
4
4
|
import { LWCLuvioWireAdapter } from './LWCLuvioWireAdapter';
|
|
5
5
|
import type { EmittableSnapshot } from './utils/SnapshotState';
|
|
6
6
|
export declare type GraphQLError = {
|
|
@@ -12,11 +12,18 @@ export declare type GraphQLError = {
|
|
|
12
12
|
path?: Array<string | number>;
|
|
13
13
|
extensions?: Record<string, any>;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
query
|
|
15
|
+
export interface GraphQLUserInput {
|
|
16
|
+
query?: object;
|
|
17
17
|
variables?: Record<string, string | number | boolean>;
|
|
18
18
|
operationName?: string;
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
|
+
export interface ResolvedGraphQLConfig extends GraphQLUserInput {
|
|
21
|
+
query?: DocumentNode;
|
|
22
|
+
}
|
|
23
|
+
export interface GraphQLBatchUserInput {
|
|
24
|
+
batchQuery: [GraphQLUserInput];
|
|
25
|
+
}
|
|
26
|
+
export declare type GraphQLInput = GraphQLUserInput | GraphQLBatchUserInput;
|
|
20
27
|
export declare type GraphQLResponse = {
|
|
21
28
|
data: any;
|
|
22
29
|
errors?: GraphQLError[];
|
|
@@ -37,6 +44,7 @@ export declare class LWCGraphQLLuvioWireAdapter extends LWCLuvioWireAdapter {
|
|
|
37
44
|
* Coerce config before calling the adapter, preserve current behavior otherwise
|
|
38
45
|
*/
|
|
39
46
|
protected callAdapter(): void;
|
|
47
|
+
resolveQueryAst(config: GraphQLUserInput): ResolvedGraphQLConfig | undefined;
|
|
40
48
|
}
|
|
41
49
|
/**
|
|
42
50
|
* Wraps a luvio Adapter in a WireAdapterConstructor that conforms to https://rfcs.lwc.dev/rfcs/lwc/0000-wire-reform#wire-adapter-protocol.
|
package/dist/umd/es5/lwcluvio.js
CHANGED
|
@@ -476,12 +476,8 @@
|
|
|
476
476
|
if (snapshot === undefined) {
|
|
477
477
|
return payload;
|
|
478
478
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
'data' in snapshot.data &&
|
|
482
|
-
snapshot.data.data !== undefined) {
|
|
483
|
-
payload.data = snapshot.data.data;
|
|
484
|
-
}
|
|
479
|
+
payload.data = extractSnapshotData(snapshot);
|
|
480
|
+
// TODO handle batch error scenarios.
|
|
485
481
|
if ('error' in snapshot && snapshot.error !== undefined) {
|
|
486
482
|
if (Array.isArray(snapshot.error)) {
|
|
487
483
|
payload.errors = snapshot.error;
|
|
@@ -501,9 +497,16 @@
|
|
|
501
497
|
}
|
|
502
498
|
LWCGraphQLLuvioWireAdapter.prototype.update = function (config, _context) {
|
|
503
499
|
this.unsubscribe();
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
500
|
+
if (config.batchQuery) {
|
|
501
|
+
this.config = {
|
|
502
|
+
batchQuery: config.batchQuery.map(function (individualConfig) {
|
|
503
|
+
return safeSanitizeGraphQLConfigObject(individualConfig);
|
|
504
|
+
}),
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
this.config = safeSanitizeGraphQLConfigObject(config);
|
|
509
|
+
}
|
|
507
510
|
this.callAdapter();
|
|
508
511
|
};
|
|
509
512
|
/**
|
|
@@ -527,27 +530,59 @@
|
|
|
527
530
|
* Coerce config before calling the adapter, preserve current behavior otherwise
|
|
528
531
|
*/
|
|
529
532
|
LWCGraphQLLuvioWireAdapter.prototype.callAdapter = function () {
|
|
533
|
+
var _this = this;
|
|
530
534
|
if (!this.connected || this.config === undefined) {
|
|
531
535
|
return;
|
|
532
536
|
}
|
|
533
|
-
var
|
|
534
|
-
|
|
535
|
-
|
|
537
|
+
var config = this.config;
|
|
538
|
+
if ('batchQuery' in config) {
|
|
539
|
+
var batchConfig = {
|
|
540
|
+
batchQuery: config.batchQuery.map(function (individualConfig) {
|
|
541
|
+
return _this.resolveQueryAst(individualConfig);
|
|
542
|
+
}),
|
|
543
|
+
};
|
|
544
|
+
// If any of the configurations are invalid, we bail out of calling the adapter.
|
|
545
|
+
if (batchConfig.batchQuery.some(function (val) { return val === undefined; })) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
var snapshotOrPromise = this.adapter(batchConfig);
|
|
549
|
+
this.processAdapterResponse(snapshotOrPromise);
|
|
550
|
+
}
|
|
551
|
+
else if ('query' in config) {
|
|
552
|
+
var singleConfig = this.resolveQueryAst(config);
|
|
553
|
+
if (singleConfig !== undefined) {
|
|
554
|
+
var snapshotOrPromise = this.adapter(singleConfig);
|
|
555
|
+
this.processAdapterResponse(snapshotOrPromise);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
LWCGraphQLLuvioWireAdapter.prototype.resolveQueryAst = function (config) {
|
|
560
|
+
if (config.query === null) {
|
|
536
561
|
return;
|
|
537
562
|
}
|
|
538
|
-
var ast = this.astResolver(query);
|
|
539
|
-
if (ast === undefined && query !== undefined) {
|
|
563
|
+
var ast = this.astResolver(config.query);
|
|
564
|
+
if (ast === undefined && config.query !== undefined) {
|
|
540
565
|
// this should only happen if the user didn't parse the query
|
|
541
566
|
if (process.env.NODE_ENV !== 'production') {
|
|
542
567
|
throw new Error(USERLAND_GRAPHQL_PARSER_ERROR_MESSAGE);
|
|
543
568
|
}
|
|
544
569
|
return;
|
|
545
570
|
}
|
|
546
|
-
var
|
|
547
|
-
|
|
571
|
+
var resolvedAdapterConfig = __assign(__assign({}, config), { query: ast });
|
|
572
|
+
return resolvedAdapterConfig;
|
|
548
573
|
};
|
|
549
574
|
return LWCGraphQLLuvioWireAdapter;
|
|
550
575
|
}(LWCLuvioWireAdapter));
|
|
576
|
+
function extractSnapshotData(snapshot) {
|
|
577
|
+
if ('data' in snapshot && snapshot.data !== undefined) {
|
|
578
|
+
var isSingleGraphQLData = 'data' in snapshot.data && snapshot.data.data !== undefined;
|
|
579
|
+
var isBatchGraphQLData = 'results' in snapshot.data && snapshot.data.results !== undefined;
|
|
580
|
+
if (isSingleGraphQLData)
|
|
581
|
+
return snapshot.data.data;
|
|
582
|
+
if (isBatchGraphQLData)
|
|
583
|
+
return snapshot.data;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
551
586
|
/**
|
|
552
587
|
* Wraps a luvio Adapter in a WireAdapterConstructor that conforms to https://rfcs.lwc.dev/rfcs/lwc/0000-wire-reform#wire-adapter-protocol.
|
|
553
588
|
*
|
|
@@ -566,6 +601,12 @@
|
|
|
566
601
|
};
|
|
567
602
|
Object.defineProperty(constructor, 'name', { value: name });
|
|
568
603
|
return constructor;
|
|
604
|
+
}
|
|
605
|
+
function safeSanitizeGraphQLConfigObject(config) {
|
|
606
|
+
// graphql query AST is passed by reference
|
|
607
|
+
// sanitizing it makes a copy and we lose that reference
|
|
608
|
+
// so we avoid sanitizing it
|
|
609
|
+
return __assign(__assign({}, sanitize(config)), { query: config.query });
|
|
569
610
|
}
|
|
570
611
|
|
|
571
612
|
exports.ADAPTER_UNFULFILLED_ERROR = ADAPTER_UNFULFILLED_ERROR;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/lwc-luvio",
|
|
3
|
-
"version": "0.126.
|
|
3
|
+
"version": "0.126.2",
|
|
4
4
|
"description": "Lightning Web Component bindings for Luvio",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"watch": "yarn build --watch"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@luvio/engine": "0.126.
|
|
28
|
+
"@luvio/engine": "0.126.2",
|
|
29
29
|
"@lwc/engine-core": "2.11.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@luvio/adapter-test-library": "0.126.
|
|
33
|
-
"@luvio/cli": "0.126.
|
|
32
|
+
"@luvio/adapter-test-library": "0.126.2",
|
|
33
|
+
"@luvio/cli": "0.126.2",
|
|
34
34
|
"@lwc/jest-preset": "11.2.2"
|
|
35
35
|
},
|
|
36
36
|
"bundlesize": [
|