@livestore/graphql 0.0.0-snapshot-72014fe5647d5ffcc631dcef96563ab453fddffb → 0.0.0-snapshot-6c61bcbb96b4666b347d3a9845d9f909cf96ae6d

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/graphql.ts +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/graphql",
3
- "version": "0.0.0-snapshot-72014fe5647d5ffcc631dcef96563ab453fddffb",
3
+ "version": "0.0.0-snapshot-6c61bcbb96b4666b347d3a9845d9f909cf96ae6d",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -12,9 +12,9 @@
12
12
  "dependencies": {
13
13
  "@graphql-typed-document-node/core": "3.2.0",
14
14
  "@opentelemetry/api": "1.9.0",
15
- "@livestore/common": "0.0.0-snapshot-72014fe5647d5ffcc631dcef96563ab453fddffb",
16
- "@livestore/livestore": "0.0.0-snapshot-72014fe5647d5ffcc631dcef96563ab453fddffb",
17
- "@livestore/utils": "0.0.0-snapshot-72014fe5647d5ffcc631dcef96563ab453fddffb"
15
+ "@livestore/common": "0.0.0-snapshot-6c61bcbb96b4666b347d3a9845d9f909cf96ae6d",
16
+ "@livestore/livestore": "0.0.0-snapshot-6c61bcbb96b4666b347d3a9845d9f909cf96ae6d",
17
+ "@livestore/utils": "0.0.0-snapshot-6c61bcbb96b4666b347d3a9845d9f909cf96ae6d"
18
18
  },
19
19
  "devDependencies": {
20
20
  "graphql": "^16.10.0"
package/src/graphql.ts CHANGED
@@ -54,7 +54,7 @@ export const queryGraphQL = <
54
54
  const label = options.label ?? documentName ?? 'graphql'
55
55
  const map = options.map
56
56
 
57
- return {
57
+ const def: LiveQueries.LiveQueryDef.Any = {
58
58
  _tag: 'def',
59
59
  make: LiveQueries.withRCMap(hash, (ctx, _otelContext) => {
60
60
  return new LiveStoreGraphQLQuery({
@@ -63,11 +63,14 @@ export const queryGraphQL = <
63
63
  label,
64
64
  map,
65
65
  reactivityGraph: ctx.reactivityGraph.deref()!,
66
+ def,
66
67
  })
67
68
  }),
68
69
  label,
69
70
  hash,
70
71
  }
72
+
73
+ return def
71
74
  }
72
75
 
73
76
  export class LiveStoreGraphQLQuery<
@@ -89,6 +92,8 @@ export class LiveStoreGraphQLQuery<
89
92
 
90
93
  reactivityGraph: LiveQueries.ReactivityGraph
91
94
 
95
+ def: LiveQueries.LiveQueryDef<TResultMapped>
96
+
92
97
  private mapResult
93
98
 
94
99
  constructor({
@@ -97,12 +102,14 @@ export class LiveStoreGraphQLQuery<
97
102
  genVariableValues,
98
103
  reactivityGraph,
99
104
  map,
105
+ def,
100
106
  }: {
101
107
  document: DocumentNode<TResult, TVariableValues>
102
108
  genVariableValues: TVariableValues | ((get: LiveQueries.GetAtomResult) => TVariableValues)
103
109
  label?: string
104
110
  reactivityGraph: LiveQueries.ReactivityGraph
105
111
  map?: MapResult<TResultMapped, TResult>
112
+ def: LiveQueries.LiveQueryDef<TResultMapped>
106
113
  }) {
107
114
  super()
108
115
 
@@ -112,6 +119,7 @@ export class LiveStoreGraphQLQuery<
112
119
  this.document = document
113
120
 
114
121
  this.reactivityGraph = reactivityGraph
122
+ this.def = def
115
123
 
116
124
  this.mapResult =
117
125
  map === undefined