@livestore/livestore 0.0.0-snapshot-a39a3b63b870a2878f22f82ce2979a6989076053 → 0.0.0-snapshot-97ca7eac46b6a583b22d40189126d06a377ec1b0

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 (94) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/QueryCache.d.ts.map +1 -1
  3. package/dist/SqliteDbWrapper.d.ts.map +1 -1
  4. package/dist/SqliteDbWrapper.js +1 -2
  5. package/dist/SqliteDbWrapper.js.map +1 -1
  6. package/dist/effect/LiveStore.d.ts +6 -38
  7. package/dist/effect/LiveStore.d.ts.map +1 -1
  8. package/dist/effect/LiveStore.js +6 -18
  9. package/dist/effect/LiveStore.js.map +1 -1
  10. package/dist/effect/mod.d.ts +3 -0
  11. package/dist/effect/mod.d.ts.map +1 -0
  12. package/dist/effect/mod.js +3 -0
  13. package/dist/effect/mod.js.map +1 -0
  14. package/dist/internal/mod.d.ts +3 -0
  15. package/dist/internal/mod.d.ts.map +1 -0
  16. package/dist/internal/mod.js +3 -0
  17. package/dist/internal/mod.js.map +1 -0
  18. package/dist/live-queries/base-class.d.ts +10 -6
  19. package/dist/live-queries/base-class.d.ts.map +1 -1
  20. package/dist/live-queries/base-class.js.map +1 -1
  21. package/dist/live-queries/computed.d.ts.map +1 -1
  22. package/dist/live-queries/computed.js +1 -1
  23. package/dist/live-queries/computed.js.map +1 -1
  24. package/dist/live-queries/db-query.d.ts.map +1 -1
  25. package/dist/live-queries/db-query.js +1 -2
  26. package/dist/live-queries/db-query.js.map +1 -1
  27. package/dist/live-queries/db-query.test.js +4 -1
  28. package/dist/live-queries/db-query.test.js.map +1 -1
  29. package/dist/live-queries/make-ref.d.ts.map +1 -1
  30. package/dist/live-queries/mod.d.ts +5 -0
  31. package/dist/live-queries/mod.d.ts.map +1 -0
  32. package/dist/live-queries/mod.js +5 -0
  33. package/dist/live-queries/mod.js.map +1 -0
  34. package/dist/mod.d.ts +14 -0
  35. package/dist/mod.d.ts.map +1 -0
  36. package/dist/mod.js +11 -0
  37. package/dist/mod.js.map +1 -0
  38. package/dist/reactive.d.ts.map +1 -1
  39. package/dist/row-query-utils.d.ts.map +1 -1
  40. package/dist/store/create-store.d.ts +35 -9
  41. package/dist/store/create-store.d.ts.map +1 -1
  42. package/dist/store/create-store.js +12 -4
  43. package/dist/store/create-store.js.map +1 -1
  44. package/dist/store/devtools.d.ts.map +1 -1
  45. package/dist/store/store-types.d.ts +6 -29
  46. package/dist/store/store-types.d.ts.map +1 -1
  47. package/dist/store/store-types.js +1 -5
  48. package/dist/store/store-types.js.map +1 -1
  49. package/dist/store/store.d.ts +4 -6
  50. package/dist/store/store.d.ts.map +1 -1
  51. package/dist/store/store.js +6 -11
  52. package/dist/store/store.js.map +1 -1
  53. package/dist/utils/data-structures.d.ts.map +1 -1
  54. package/dist/utils/dev.d.ts.map +1 -1
  55. package/dist/utils/function-string.d.ts.map +1 -1
  56. package/dist/utils/stack-info.d.ts.map +1 -1
  57. package/dist/utils/tests/fixture.d.ts +1 -1
  58. package/dist/utils/tests/fixture.d.ts.map +1 -1
  59. package/dist/utils/tests/fixture.js.map +1 -1
  60. package/dist/utils/tests/otel.d.ts.map +1 -1
  61. package/package.json +20 -22
  62. package/src/SqliteDbWrapper.ts +8 -2
  63. package/src/effect/LiveStore.ts +22 -70
  64. package/src/effect/{index.ts → mod.ts} +2 -3
  65. package/src/internal/mod.ts +2 -0
  66. package/src/live-queries/base-class.ts +12 -7
  67. package/src/live-queries/computed.ts +1 -1
  68. package/src/live-queries/db-query.test.ts +4 -1
  69. package/src/live-queries/db-query.ts +1 -1
  70. package/src/live-queries/mod.ts +4 -0
  71. package/src/mod.ts +37 -0
  72. package/src/store/create-store.ts +56 -20
  73. package/src/store/store-types.ts +6 -30
  74. package/src/store/store.ts +11 -25
  75. package/src/utils/tests/fixture.ts +1 -1
  76. package/dist/effect/index.d.ts +0 -2
  77. package/dist/effect/index.d.ts.map +0 -1
  78. package/dist/effect/index.js +0 -2
  79. package/dist/effect/index.js.map +0 -1
  80. package/dist/index.d.ts +0 -19
  81. package/dist/index.d.ts.map +0 -1
  82. package/dist/index.js +0 -16
  83. package/dist/index.js.map +0 -1
  84. package/dist/live-queries/graphql.d.ts +0 -49
  85. package/dist/live-queries/graphql.d.ts.map +0 -1
  86. package/dist/live-queries/graphql.js +0 -147
  87. package/dist/live-queries/graphql.js.map +0 -1
  88. package/dist/utils/otel.d.ts +0 -4
  89. package/dist/utils/otel.d.ts.map +0 -1
  90. package/dist/utils/otel.js +0 -6
  91. package/dist/utils/otel.js.map +0 -1
  92. package/src/index.ts +0 -72
  93. package/src/live-queries/graphql.ts +0 -244
  94. package/src/utils/otel.ts +0 -9
@@ -8,6 +8,7 @@ import type {
8
8
  } from '@livestore/common'
9
9
  import {
10
10
  Devtools,
11
+ getDurationMsFromSpan,
11
12
  getExecArgsFromMutation,
12
13
  getResultSchema,
13
14
  IntentionalShutdownCause,
@@ -20,6 +21,7 @@ import {
20
21
  } from '@livestore/common'
21
22
  import type { LiveStoreSchema } from '@livestore/common/schema'
22
23
  import {
24
+ getMutationDef,
23
25
  MutationEvent,
24
26
  SCHEMA_META_TABLE,
25
27
  SCHEMA_MUTATIONS_META_TABLE,
@@ -40,7 +42,6 @@ import {
40
42
  } from '@livestore/utils/effect'
41
43
  import { nanoid } from '@livestore/utils/nanoid'
42
44
  import * as otel from '@opentelemetry/api'
43
- import { type GraphQLSchema } from 'graphql'
44
45
 
45
46
  import type {
46
47
  ILiveQueryRefDef,
@@ -55,32 +56,20 @@ import { makeExecBeforeFirstRun } from '../row-query-utils.js'
55
56
  import { SqliteDbWrapper } from '../SqliteDbWrapper.js'
56
57
  import { ReferenceCountedSet } from '../utils/data-structures.js'
57
58
  import { downloadBlob, exposeDebugUtils } from '../utils/dev.js'
58
- import { getDurationMsFromSpan } from '../utils/otel.js'
59
59
  import type { StackInfo } from '../utils/stack-info.js'
60
- import type {
61
- BaseGraphQLContext,
62
- RefreshReason,
63
- StoreMutateOptions,
64
- StoreOptions,
65
- StoreOtel,
66
- Unsubscribe,
67
- } from './store-types.js'
60
+ import type { RefreshReason, StoreMutateOptions, StoreOptions, StoreOtel, Unsubscribe } from './store-types.js'
68
61
 
69
62
  if (isDevEnv()) {
70
63
  exposeDebugUtils()
71
64
  }
72
65
 
73
- export class Store<
74
- TGraphQLContext extends BaseGraphQLContext = BaseGraphQLContext,
75
- TSchema extends LiveStoreSchema = LiveStoreSchema,
76
- > extends Inspectable.Class {
66
+ export class Store<TSchema extends LiveStoreSchema = LiveStoreSchema, TContext = {}> extends Inspectable.Class {
77
67
  readonly storeId: string
78
68
  reactivityGraph: ReactivityGraph
79
69
  sqliteDbWrapper: SqliteDbWrapper
80
70
  clientSession: ClientSession
81
71
  schema: LiveStoreSchema
82
- graphQLSchema?: GraphQLSchema
83
- graphQLContext?: TGraphQLContext
72
+ context: TContext
84
73
  otel: StoreOtel
85
74
  /**
86
75
  * Note we're using `Ref<null>` here as we don't care about the value but only about *that* something has changed.
@@ -105,8 +94,8 @@ export class Store<
105
94
  constructor({
106
95
  clientSession,
107
96
  schema,
108
- graphQLOptions,
109
97
  otelOptions,
98
+ context,
110
99
  disableDevtools,
111
100
  batchUpdates,
112
101
  unsyncedMutationEvents,
@@ -114,7 +103,7 @@ export class Store<
114
103
  lifetimeScope,
115
104
  runtime,
116
105
  params,
117
- }: StoreOptions<TGraphQLContext, TSchema>) {
106
+ }: StoreOptions<TSchema, TContext>) {
118
107
  super()
119
108
 
120
109
  this.storeId = storeId
@@ -123,6 +112,7 @@ export class Store<
123
112
  this.sqliteDbWrapper = new SqliteDbWrapper({ otel: otelOptions, db: clientSession.sqliteDb })
124
113
  this.clientSession = clientSession
125
114
  this.schema = schema
115
+ this.context = context
126
116
 
127
117
  this.lifetimeScope = lifetimeScope
128
118
  this.runtime = runtime
@@ -136,7 +126,8 @@ export class Store<
136
126
  clientSession,
137
127
  runtime,
138
128
  applyMutation: (mutationEventDecoded, { otelContext, withChangeset }) => {
139
- const mutationDef = schema.mutations.get(mutationEventDecoded.mutation)!
129
+ const mutationDef = getMutationDef(schema, mutationEventDecoded.mutation)
130
+
140
131
  const execArgsArr = getExecArgsFromMutation({
141
132
  mutationDef,
142
133
  mutationEvent: { decoded: mutationEventDecoded, encoded: undefined },
@@ -198,7 +189,7 @@ export class Store<
198
189
 
199
190
  this.reactivityGraph = reactivityGraph
200
191
  this.reactivityGraph.context = {
201
- store: this as unknown as Store<BaseGraphQLContext, LiveStoreSchema>,
192
+ store: this as unknown as Store<LiveStoreSchema>,
202
193
  defRcMap: new Map(),
203
194
  reactivityGraph: new WeakRef(reactivityGraph),
204
195
  otelTracer: otelOptions.tracer,
@@ -235,11 +226,6 @@ export class Store<
235
226
  this.tableRefs[tableName] = existingTableRefs.get(tableName) ?? this.makeTableRef(tableName)
236
227
  }
237
228
 
238
- if (graphQLOptions) {
239
- this.graphQLSchema = graphQLOptions.schema
240
- this.graphQLContext = graphQLOptions.makeContext(this.sqliteDbWrapper, this.otel.tracer, clientSession.sessionId)
241
- }
242
-
243
229
  this.boot = Effect.gen(this, function* () {
244
230
  yield* Effect.addFinalizer(() =>
245
231
  Effect.sync(() => {
@@ -52,7 +52,7 @@ export const makeTodoMvc = ({
52
52
  otelContext?: otel.Context
53
53
  } = {}) =>
54
54
  Effect.gen(function* () {
55
- const store: Store<any, FixtureSchema> = yield* createStore({
55
+ const store: Store<FixtureSchema> = yield* createStore({
56
56
  schema,
57
57
  storeId: 'default',
58
58
  adapter: makeInMemoryAdapter(),
@@ -1,2 +0,0 @@
1
- export { LiveStoreContextLayer, LiveStoreContextRunning as LiveStoreContext, LiveStoreContextRunning, LiveStoreContextDeferred, DeferredStoreContext, type LiveStoreContextProps, } from './LiveStore.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/effect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,IAAI,gBAAgB,EAC3C,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAA"}
@@ -1,2 +0,0 @@
1
- export { LiveStoreContextLayer, LiveStoreContextRunning as LiveStoreContext, LiveStoreContextRunning, LiveStoreContextDeferred, DeferredStoreContext, } from './LiveStore.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/effect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,IAAI,gBAAgB,EAC3C,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,GAErB,MAAM,gBAAgB,CAAA"}
package/dist/index.d.ts DELETED
@@ -1,19 +0,0 @@
1
- export { Store } from './store/store.js';
2
- export { createStore, createStorePromise, type CreateStoreOptions } from './store/create-store.js';
3
- export type { BaseGraphQLContext, QueryDebugInfo, RefreshReason, GraphQLOptions, OtelOptions, } from './store/store-types.js';
4
- export { StoreAbort, StoreInterrupted, type LiveStoreContext, type ShutdownDeferred, type LiveStoreContextRunning, } from './store/store-types.js';
5
- export { SqliteDbWrapper, emptyDebugInfo } from './SqliteDbWrapper.js';
6
- export type { GetAtom, AtomDebugInfo, RefreshDebugInfo, ReactiveGraphSnapshot, SerializedAtom, SerializedEffect, Atom, Node, Ref, Effect, } from './reactive.js';
7
- export { LiveStoreComputedQuery, computed } from './live-queries/computed.js';
8
- export { LiveStoreDbQuery, queryDb } from './live-queries/db-query.js';
9
- export { LiveStoreGraphQLQuery, queryGraphQL } from './live-queries/graphql.js';
10
- export { makeRef, type LiveQueryRef } from './live-queries/make-ref.js';
11
- export { type GetAtomResult, type ReactivityGraph, makeReactivityGraph, type LiveQuery, type GetResult, type LiveQueryAny, type LiveQueryDef, type LiveQueryDefAny, type RcRef, } from './live-queries/base-class.js';
12
- export { deriveColQuery } from './row-query-utils.js';
13
- export * from '@livestore/common/schema';
14
- export { sql, SessionIdSymbol, type BootStatus, type SqliteDb, type DebugInfo, type MutableDebugInfo, prepareBindValues, type Bindable, type PreparedBindValues, type QueryBuilderAst, type QueryBuilder, type RowQuery, } from '@livestore/common';
15
- export { deepEqual } from '@livestore/utils';
16
- export { nanoid } from '@livestore/utils/nanoid';
17
- export * from './utils/stack-info.js';
18
- export type { ClientSession, Adapter, PreparedStatement } from '@livestore/common';
19
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAClG,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,GACZ,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEtE,YAAY,EACV,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,MAAM,GACP,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC/E,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,mBAAmB,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,KAAK,GACX,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,cAAc,0BAA0B,CAAA;AACxC,OAAO,EACL,GAAG,EACH,eAAe,EACf,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,iBAAiB,EACjB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,QAAQ,GACd,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,cAAc,uBAAuB,CAAA;AAErC,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA"}
package/dist/index.js DELETED
@@ -1,16 +0,0 @@
1
- export { Store } from './store/store.js';
2
- export { createStore, createStorePromise } from './store/create-store.js';
3
- export { StoreAbort, StoreInterrupted, } from './store/store-types.js';
4
- export { SqliteDbWrapper, emptyDebugInfo } from './SqliteDbWrapper.js';
5
- export { LiveStoreComputedQuery, computed } from './live-queries/computed.js';
6
- export { LiveStoreDbQuery, queryDb } from './live-queries/db-query.js';
7
- export { LiveStoreGraphQLQuery, queryGraphQL } from './live-queries/graphql.js';
8
- export { makeRef } from './live-queries/make-ref.js';
9
- export { makeReactivityGraph, } from './live-queries/base-class.js';
10
- export { deriveColQuery } from './row-query-utils.js';
11
- export * from '@livestore/common/schema';
12
- export { sql, SessionIdSymbol, prepareBindValues, } from '@livestore/common';
13
- export { deepEqual } from '@livestore/utils';
14
- export { nanoid } from '@livestore/utils/nanoid';
15
- export * from './utils/stack-info.js';
16
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAA2B,MAAM,yBAAyB,CAAA;AASlG,OAAO,EACL,UAAU,EACV,gBAAgB,GAIjB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AActE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC/E,OAAO,EAAE,OAAO,EAAqB,MAAM,4BAA4B,CAAA;AACvE,OAAO,EAGL,mBAAmB,GAOpB,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,cAAc,0BAA0B,CAAA;AACxC,OAAO,EACL,GAAG,EACH,eAAe,EAKf,iBAAiB,GAMlB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,cAAc,uBAAuB,CAAA"}
@@ -1,49 +0,0 @@
1
- import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
2
- import type { QueryInfo } from '@livestore/common';
3
- import { Schema } from '@livestore/utils/effect';
4
- import * as otel from '@opentelemetry/api';
5
- import * as graphql from 'graphql';
6
- import { type Thunk } from '../reactive.js';
7
- import type { Store } from '../store/store.js';
8
- import type { BaseGraphQLContext, RefreshReason } from '../store/store-types.js';
9
- import type { DepKey, GetAtomResult, LiveQueryDef, ReactivityGraph, ReactivityGraphContext } from './base-class.js';
10
- import { LiveStoreQueryBase } from './base-class.js';
11
- export type MapResult<To, From> = ((res: From, get: GetAtomResult) => To) | Schema.Schema<To, From>;
12
- export declare const queryGraphQL: <TResult extends Record<string, any>, TVariableValues extends Record<string, any>, TResultMapped extends Record<string, any> = TResult>(document: DocumentNode<TResult, TVariableValues>, genVariableValues: TVariableValues | ((get: GetAtomResult) => TVariableValues), options?: {
13
- label?: string;
14
- map?: MapResult<TResultMapped, TResult>;
15
- deps?: DepKey;
16
- }) => LiveQueryDef<TResultMapped, QueryInfo.None>;
17
- export declare class LiveStoreGraphQLQuery<TResult extends Record<string, any>, TVariableValues extends Record<string, any>, TContext extends BaseGraphQLContext, TResultMapped extends Record<string, any> = TResult> extends LiveStoreQueryBase<TResultMapped, QueryInfo.None> {
18
- _tag: 'graphql';
19
- /** The abstract GraphQL query */
20
- document: DocumentNode<TResult, TVariableValues>;
21
- /** A reactive thunk representing the query results */
22
- results$: Thunk<TResultMapped, ReactivityGraphContext, RefreshReason>;
23
- variableValues$: Thunk<TVariableValues, ReactivityGraphContext, RefreshReason> | undefined;
24
- label: string;
25
- reactivityGraph: ReactivityGraph;
26
- queryInfo: QueryInfo.None;
27
- private mapResult;
28
- constructor({ document, label, genVariableValues, reactivityGraph, map, }: {
29
- document: DocumentNode<TResult, TVariableValues>;
30
- genVariableValues: TVariableValues | ((get: GetAtomResult) => TVariableValues);
31
- label?: string;
32
- reactivityGraph: ReactivityGraph;
33
- map?: MapResult<TResultMapped, TResult>;
34
- });
35
- queryOnce: ({ document, otelContext, otelTracer, variableValues, store, get, }: {
36
- document: graphql.DocumentNode;
37
- otelContext: otel.Context;
38
- otelTracer: otel.Tracer;
39
- variableValues: TVariableValues;
40
- store: Store<TContext>;
41
- get: GetAtomResult;
42
- }) => {
43
- result: TResultMapped;
44
- queriedTables: string[];
45
- durationMs: number;
46
- };
47
- destroy: () => void;
48
- }
49
- //# sourceMappingURL=graphql.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/live-queries/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,EAAE,MAAM,EAAiB,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAElC,OAAO,EAAW,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEhF,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AACnH,OAAO,EAAgB,kBAAkB,EAAgC,MAAM,iBAAiB,CAAA;AAEhG,MAAM,MAAM,SAAS,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,aAAa,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;AAEnG,eAAO,MAAM,YAAY,GACvB,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnC,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3C,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBAE/B,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,qBAC7B,eAAe,GAAG,CAAC,CAAC,GAAG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Ae,CAAA;QAChC,GAAG,CAAC,EAAE,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;KACxC;IA2ED,SAAS,uEAON;QACD,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAA;QAC9B,WAAW,EAAE,IAAI,CAAC,OAAO,CAAA;QACzB,UAAU,EAAE,IAAI,CAAC,MAAM,CAAA;QACvB,cAAc,EAAE,eAAe,CAAA;QAC/B,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;QACtB,GAAG,EAAE,aAAa,CAAA;KACnB;;;;MAmDA;IAED,OAAO,aAUN;CACF"}
@@ -1,147 +0,0 @@
1
- import { shouldNeverHappen } from '@livestore/utils';
2
- import { Schema, TreeFormatter } from '@livestore/utils/effect';
3
- import * as otel from '@opentelemetry/api';
4
- import * as graphql from 'graphql';
5
- import { isThunk } from '../reactive.js';
6
- import { getDurationMsFromSpan } from '../utils/otel.js';
7
- import { depsToString, LiveStoreQueryBase, makeGetAtomResult, withRCMap } from './base-class.js';
8
- export const queryGraphQL = (document, genVariableValues, options = {}) => {
9
- const documentName = graphql.getOperationAST(document)?.name?.value;
10
- const hash = options.deps
11
- ? depsToString(options.deps)
12
- : (documentName ?? shouldNeverHappen('No document name found and no deps provided'));
13
- const label = options.label ?? documentName ?? 'graphql';
14
- const map = options.map;
15
- return {
16
- _tag: 'def',
17
- make: withRCMap(hash, (ctx, _otelContext) => {
18
- return new LiveStoreGraphQLQuery({
19
- document,
20
- genVariableValues,
21
- label,
22
- map,
23
- reactivityGraph: ctx.reactivityGraph.deref(),
24
- });
25
- }),
26
- label,
27
- hash,
28
- queryInfo: { _tag: 'None' },
29
- };
30
- };
31
- export class LiveStoreGraphQLQuery extends LiveStoreQueryBase {
32
- _tag = 'graphql';
33
- /** The abstract GraphQL query */
34
- document;
35
- /** A reactive thunk representing the query results */
36
- results$;
37
- variableValues$;
38
- label;
39
- reactivityGraph;
40
- queryInfo = { _tag: 'None' };
41
- mapResult;
42
- constructor({ document, label, genVariableValues, reactivityGraph, map, }) {
43
- super();
44
- const labelWithDefault = label ?? graphql.getOperationAST(document)?.name?.value ?? 'graphql';
45
- this.label = labelWithDefault;
46
- this.document = document;
47
- this.reactivityGraph = reactivityGraph;
48
- this.mapResult =
49
- map === undefined
50
- ? (res) => res
51
- : Schema.isSchema(map)
52
- ? (res) => {
53
- const parseResult = Schema.decodeEither(map)(res);
54
- if (parseResult._tag === 'Left') {
55
- console.error(`Error parsing GraphQL query result: ${TreeFormatter.formatErrorSync(parseResult.left)}`);
56
- return shouldNeverHappen(`Error parsing SQL query result: ${parseResult.left}`);
57
- }
58
- else {
59
- return parseResult.right;
60
- }
61
- }
62
- : typeof map === 'function'
63
- ? map
64
- : shouldNeverHappen(`Invalid map function ${map}`);
65
- // TODO don't even create a thunk if variables are static
66
- let variableValues$OrvariableValues;
67
- if (typeof genVariableValues === 'function') {
68
- variableValues$OrvariableValues = this.reactivityGraph.makeThunk((get, _setDebugInfo, ctx, otelContext) => {
69
- return genVariableValues(makeGetAtomResult(get, ctx, otelContext ?? ctx.rootOtelContext, this.dependencyQueriesRef));
70
- }, { label: `${labelWithDefault}:variableValues`, meta: { liveStoreThunkType: 'graphql.variables' } });
71
- this.variableValues$ = variableValues$OrvariableValues;
72
- }
73
- else {
74
- variableValues$OrvariableValues = genVariableValues;
75
- }
76
- const resultsLabel = `${labelWithDefault}:results`;
77
- this.results$ = this.reactivityGraph.makeThunk((get, setDebugInfo, ctx, otelContext, debugRefreshReason) => {
78
- const { store, otelTracer, rootOtelContext } = ctx;
79
- const variableValues = isThunk(variableValues$OrvariableValues)
80
- ? get(variableValues$OrvariableValues, otelContext, debugRefreshReason)
81
- : variableValues$OrvariableValues;
82
- const { result, queriedTables, durationMs } = this.queryOnce({
83
- document,
84
- variableValues,
85
- otelContext: otelContext ?? rootOtelContext,
86
- otelTracer,
87
- store: store,
88
- get: makeGetAtomResult(get, ctx, otelContext ?? rootOtelContext, this.dependencyQueriesRef),
89
- });
90
- // Add dependencies on any tables that were used
91
- for (const tableName of queriedTables) {
92
- const tableRef = store.tableRefs[tableName] ?? shouldNeverHappen(`No table ref found for ${tableName}`);
93
- get(tableRef);
94
- }
95
- setDebugInfo({ _tag: 'graphql', label: resultsLabel, query: graphql.print(document), durationMs });
96
- return result;
97
- }, { label: resultsLabel, meta: { liveStoreThunkType: 'graphql.result' } });
98
- }
99
- queryOnce = ({ document, otelContext, otelTracer, variableValues, store, get, }) => {
100
- const schema = store.graphQLSchema ?? shouldNeverHappen("Can't run a GraphQL query on a store without GraphQL schema");
101
- const context = store.graphQLContext ?? shouldNeverHappen("Can't run a GraphQL query on a store without GraphQL context");
102
- const operationName = graphql.getOperationAST(document)?.name?.value;
103
- return otelTracer.startActiveSpan(`executeGraphQLQuery: ${operationName}`, {}, otelContext, (span) => {
104
- span.setAttribute('graphql.variables', JSON.stringify(variableValues));
105
- span.setAttribute('graphql.query', graphql.print(document));
106
- context.queriedTables.clear();
107
- context.otelContext = otel.trace.setSpan(otel.context.active(), span);
108
- const res = graphql.executeSync({
109
- document,
110
- contextValue: context,
111
- schema: schema,
112
- variableValues,
113
- });
114
- // TODO track number of nested SQL queries via Otel + debug info
115
- if (res.errors) {
116
- span.setStatus({ code: otel.SpanStatusCode.ERROR, message: 'GraphQL error' });
117
- span.setAttribute('graphql.error', res.errors.join('\n'));
118
- span.setAttribute('graphql.error-detail', JSON.stringify(res.errors));
119
- console.error(`graphql error (${operationName}) - ${res.errors.length} errors`);
120
- for (const error of res.errors) {
121
- console.error(error);
122
- }
123
- debugger;
124
- shouldNeverHappen(`GraphQL error: ${res.errors.join('\n')}`);
125
- }
126
- span.end();
127
- const result = this.mapResult(res.data, get);
128
- const durationMs = getDurationMsFromSpan(span);
129
- this.executionTimes.push(durationMs);
130
- return {
131
- result,
132
- queriedTables: Array.from(context.queriedTables.values()),
133
- durationMs,
134
- };
135
- });
136
- };
137
- destroy = () => {
138
- if (this.variableValues$ !== undefined) {
139
- this.reactivityGraph.destroyNode(this.variableValues$);
140
- }
141
- this.reactivityGraph.destroyNode(this.results$);
142
- for (const query of this.dependencyQueriesRef) {
143
- query.deref();
144
- }
145
- };
146
- }
147
- //# sourceMappingURL=graphql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../src/live-queries/graphql.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAElC,OAAO,EAAE,OAAO,EAAc,MAAM,gBAAgB,CAAA;AAGpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAIhG,MAAM,CAAC,MAAM,YAAY,GAAG,CAK1B,QAAgD,EAChD,iBAA8E,EAC9E,UAKI,EAAE,EACuC,EAAE;IAC/C,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,CAAA;IACnE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI;QACvB,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;QAC5B,CAAC,CAAC,CAAC,YAAY,IAAI,iBAAiB,CAAC,6CAA6C,CAAC,CAAC,CAAA;IACtF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,YAAY,IAAI,SAAS,CAAA;IACxD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IAEvB,OAAO;QACL,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE;YAC1C,OAAO,IAAI,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AC,MAAM,CAAC,MAAM,SAAS,CAAC,CAAA;gBAC/E,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;oBAC/B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;gBACtB,CAAC;gBACD,QAAQ,CAAA;gBACR,iBAAiB,CAAC,kBAAkB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAC9D,CAAC;YAED,IAAI,CAAC,GAAG,EAAE,CAAA;YAEV,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAA0B,EAAE,GAAG,CAAC,CAAA;YAElE,MAAM,UAAU,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAA;YAE9C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YAEpC,OAAO;gBACL,MAAM;gBACN,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;gBACzD,UAAU;aACX,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,OAAO,GAAG,GAAG,EAAE;QACb,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACvC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QACxD,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAE/C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC9C,KAAK,CAAC,KAAK,EAAE,CAAA;QACf,CAAC;IACH,CAAC,CAAA;CACF"}
@@ -1,4 +0,0 @@
1
- import type * as otel from '@opentelemetry/api';
2
- export declare const getDurationMsFromSpan: (span: otel.Span) => number;
3
- export declare const getStartTimeHighResFromSpan: (span: otel.Span) => DOMHighResTimeStamp;
4
- //# sourceMappingURL=otel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"otel.d.ts","sourceRoot":"","sources":["../../src/utils/otel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAE/C,eAAO,MAAM,qBAAqB,SAAU,IAAI,CAAC,IAAI,KAAG,MAGvD,CAAA;AAED,eAAO,MAAM,2BAA2B,SAAU,IAAI,CAAC,IAAI,KAAG,mBACF,CAAA"}
@@ -1,6 +0,0 @@
1
- export const getDurationMsFromSpan = (span) => {
2
- const durationHr = span._duration;
3
- return durationHr[0] * 1000 + durationHr[1] / 1_000_000;
4
- };
5
- export const getStartTimeHighResFromSpan = (span) => span._performanceStartTime;
6
- //# sourceMappingURL=otel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"otel.js","sourceRoot":"","sources":["../../src/utils/otel.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAe,EAAU,EAAE;IAC/D,MAAM,UAAU,GAAsC,IAAY,CAAC,SAAS,CAAA;IAC5E,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;AACzD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,IAAe,EAAuB,EAAE,CACjF,IAAY,CAAC,qBAA4C,CAAA"}
package/src/index.ts DELETED
@@ -1,72 +0,0 @@
1
- export { Store } from './store/store.js'
2
- export { createStore, createStorePromise, type CreateStoreOptions } from './store/create-store.js'
3
- export type {
4
- BaseGraphQLContext,
5
- QueryDebugInfo,
6
- RefreshReason,
7
- GraphQLOptions,
8
- OtelOptions,
9
- } from './store/store-types.js'
10
-
11
- export {
12
- StoreAbort,
13
- StoreInterrupted,
14
- type LiveStoreContext,
15
- type ShutdownDeferred,
16
- type LiveStoreContextRunning,
17
- } from './store/store-types.js'
18
-
19
- export { SqliteDbWrapper, emptyDebugInfo } from './SqliteDbWrapper.js'
20
-
21
- export type {
22
- GetAtom,
23
- AtomDebugInfo,
24
- RefreshDebugInfo,
25
- ReactiveGraphSnapshot,
26
- SerializedAtom,
27
- SerializedEffect,
28
- Atom,
29
- Node,
30
- Ref,
31
- Effect,
32
- } from './reactive.js'
33
- export { LiveStoreComputedQuery, computed } from './live-queries/computed.js'
34
- export { LiveStoreDbQuery, queryDb } from './live-queries/db-query.js'
35
- export { LiveStoreGraphQLQuery, queryGraphQL } from './live-queries/graphql.js'
36
- export { makeRef, type LiveQueryRef } from './live-queries/make-ref.js'
37
- export {
38
- type GetAtomResult,
39
- type ReactivityGraph,
40
- makeReactivityGraph,
41
- type LiveQuery,
42
- type GetResult,
43
- type LiveQueryAny,
44
- type LiveQueryDef,
45
- type LiveQueryDefAny,
46
- type RcRef,
47
- } from './live-queries/base-class.js'
48
-
49
- export { deriveColQuery } from './row-query-utils.js'
50
-
51
- export * from '@livestore/common/schema'
52
- export {
53
- sql,
54
- SessionIdSymbol,
55
- type BootStatus,
56
- type SqliteDb,
57
- type DebugInfo,
58
- type MutableDebugInfo,
59
- prepareBindValues,
60
- type Bindable,
61
- type PreparedBindValues,
62
- type QueryBuilderAst,
63
- type QueryBuilder,
64
- type RowQuery,
65
- } from '@livestore/common'
66
-
67
- export { deepEqual } from '@livestore/utils'
68
- export { nanoid } from '@livestore/utils/nanoid'
69
-
70
- export * from './utils/stack-info.js'
71
-
72
- export type { ClientSession, Adapter, PreparedStatement } from '@livestore/common'