@livestore/livestore 0.0.9 → 0.0.12

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 (152) hide show
  1. package/package.json +7 -7
  2. package/src/__tests__/react/fixture.tsx +1 -13
  3. package/src/__tests__/reactive.test.ts +39 -0
  4. package/src/inMemoryDatabase.ts +5 -5
  5. package/src/react/useGraphQL.ts +6 -7
  6. package/src/react/useLiveStoreComponent.ts +38 -48
  7. package/src/reactive.ts +12 -11
  8. package/src/reactiveQueries/graphql.ts +5 -3
  9. package/src/reactiveQueries/js.ts +1 -3
  10. package/src/reactiveQueries/sql.ts +6 -6
  11. package/src/store.ts +45 -31
  12. package/dist/.tsbuildinfo +0 -1
  13. package/dist/QueryCache.d.ts +0 -20
  14. package/dist/QueryCache.d.ts.map +0 -1
  15. package/dist/QueryCache.js +0 -71
  16. package/dist/QueryCache.js.map +0 -1
  17. package/dist/__tests__/react/fixture.d.ts +0 -141
  18. package/dist/__tests__/react/fixture.d.ts.map +0 -1
  19. package/dist/__tests__/react/fixture.js +0 -72
  20. package/dist/__tests__/react/fixture.js.map +0 -1
  21. package/dist/__tests__/react/useLiveStoreComponent.test.d.ts +0 -2
  22. package/dist/__tests__/react/useLiveStoreComponent.test.d.ts.map +0 -1
  23. package/dist/__tests__/react/useLiveStoreComponent.test.js +0 -78
  24. package/dist/__tests__/react/useLiveStoreComponent.test.js.map +0 -1
  25. package/dist/__tests__/reactive.test.d.ts +0 -2
  26. package/dist/__tests__/reactive.test.d.ts.map +0 -1
  27. package/dist/__tests__/reactive.test.js +0 -167
  28. package/dist/__tests__/reactive.test.js.map +0 -1
  29. package/dist/backends/base.d.ts +0 -13
  30. package/dist/backends/base.d.ts.map +0 -1
  31. package/dist/backends/base.js +0 -53
  32. package/dist/backends/base.js.map +0 -1
  33. package/dist/backends/index.d.ts +0 -45
  34. package/dist/backends/index.d.ts.map +0 -1
  35. package/dist/backends/index.js +0 -38
  36. package/dist/backends/index.js.map +0 -1
  37. package/dist/backends/noop.d.ts +0 -18
  38. package/dist/backends/noop.d.ts.map +0 -1
  39. package/dist/backends/noop.js +0 -21
  40. package/dist/backends/noop.js.map +0 -1
  41. package/dist/backends/tauri.d.ts +0 -22
  42. package/dist/backends/tauri.d.ts.map +0 -1
  43. package/dist/backends/tauri.js +0 -48
  44. package/dist/backends/tauri.js.map +0 -1
  45. package/dist/backends/utils/idb.d.ts +0 -10
  46. package/dist/backends/utils/idb.d.ts.map +0 -1
  47. package/dist/backends/utils/idb.js +0 -58
  48. package/dist/backends/utils/idb.js.map +0 -1
  49. package/dist/backends/web-in-memory.d.ts +0 -22
  50. package/dist/backends/web-in-memory.d.ts.map +0 -1
  51. package/dist/backends/web-in-memory.js +0 -45
  52. package/dist/backends/web-in-memory.js.map +0 -1
  53. package/dist/backends/web-worker.d.ts +0 -17
  54. package/dist/backends/web-worker.d.ts.map +0 -1
  55. package/dist/backends/web-worker.js +0 -139
  56. package/dist/backends/web-worker.js.map +0 -1
  57. package/dist/backends/web.d.ts +0 -27
  58. package/dist/backends/web.d.ts.map +0 -1
  59. package/dist/backends/web.js +0 -63
  60. package/dist/backends/web.js.map +0 -1
  61. package/dist/bounded-collections.d.ts +0 -34
  62. package/dist/bounded-collections.d.ts.map +0 -1
  63. package/dist/bounded-collections.js +0 -103
  64. package/dist/bounded-collections.js.map +0 -1
  65. package/dist/componentKey.d.ts +0 -20
  66. package/dist/componentKey.d.ts.map +0 -1
  67. package/dist/componentKey.js +0 -3
  68. package/dist/componentKey.js.map +0 -1
  69. package/dist/effect/LiveStore.d.ts +0 -42
  70. package/dist/effect/LiveStore.d.ts.map +0 -1
  71. package/dist/effect/LiveStore.js +0 -40
  72. package/dist/effect/LiveStore.js.map +0 -1
  73. package/dist/effect/index.d.ts +0 -2
  74. package/dist/effect/index.d.ts.map +0 -1
  75. package/dist/effect/index.js +0 -2
  76. package/dist/effect/index.js.map +0 -1
  77. package/dist/events.d.ts +0 -7
  78. package/dist/events.d.ts.map +0 -1
  79. package/dist/events.js +0 -2
  80. package/dist/events.js.map +0 -1
  81. package/dist/inMemoryDatabase.d.ts +0 -65
  82. package/dist/inMemoryDatabase.d.ts.map +0 -1
  83. package/dist/inMemoryDatabase.js +0 -241
  84. package/dist/inMemoryDatabase.js.map +0 -1
  85. package/dist/index.d.ts +0 -20
  86. package/dist/index.d.ts.map +0 -1
  87. package/dist/index.js +0 -10
  88. package/dist/index.js.map +0 -1
  89. package/dist/otel.d.ts +0 -5
  90. package/dist/otel.d.ts.map +0 -1
  91. package/dist/otel.js +0 -17
  92. package/dist/otel.js.map +0 -1
  93. package/dist/react/LiveStoreContext.d.ts +0 -11
  94. package/dist/react/LiveStoreContext.d.ts.map +0 -1
  95. package/dist/react/LiveStoreContext.js +0 -10
  96. package/dist/react/LiveStoreContext.js.map +0 -1
  97. package/dist/react/LiveStoreProvider.d.ts +0 -21
  98. package/dist/react/LiveStoreProvider.d.ts.map +0 -1
  99. package/dist/react/LiveStoreProvider.js +0 -48
  100. package/dist/react/LiveStoreProvider.js.map +0 -1
  101. package/dist/react/index.d.ts +0 -7
  102. package/dist/react/index.d.ts.map +0 -1
  103. package/dist/react/index.js +0 -6
  104. package/dist/react/index.js.map +0 -1
  105. package/dist/react/useGlobalQuery.d.ts +0 -3
  106. package/dist/react/useGlobalQuery.d.ts.map +0 -1
  107. package/dist/react/useGlobalQuery.js +0 -25
  108. package/dist/react/useGlobalQuery.js.map +0 -1
  109. package/dist/react/useGraphQL.d.ts +0 -11
  110. package/dist/react/useGraphQL.d.ts.map +0 -1
  111. package/dist/react/useGraphQL.js +0 -68
  112. package/dist/react/useGraphQL.js.map +0 -1
  113. package/dist/react/useLiveStoreComponent.d.ts +0 -70
  114. package/dist/react/useLiveStoreComponent.d.ts.map +0 -1
  115. package/dist/react/useLiveStoreComponent.js +0 -261
  116. package/dist/react/useLiveStoreComponent.js.map +0 -1
  117. package/dist/react/utils/useStateRefWithReactiveInput.d.ts +0 -13
  118. package/dist/react/utils/useStateRefWithReactiveInput.d.ts.map +0 -1
  119. package/dist/react/utils/useStateRefWithReactiveInput.js +0 -38
  120. package/dist/react/utils/useStateRefWithReactiveInput.js.map +0 -1
  121. package/dist/reactive.d.ts +0 -140
  122. package/dist/reactive.d.ts.map +0 -1
  123. package/dist/reactive.js +0 -301
  124. package/dist/reactive.js.map +0 -1
  125. package/dist/reactiveQueries/base-class.d.ts +0 -24
  126. package/dist/reactiveQueries/base-class.d.ts.map +0 -1
  127. package/dist/reactiveQueries/base-class.js +0 -22
  128. package/dist/reactiveQueries/base-class.js.map +0 -1
  129. package/dist/reactiveQueries/graphql.d.ts +0 -25
  130. package/dist/reactiveQueries/graphql.d.ts.map +0 -1
  131. package/dist/reactiveQueries/graphql.js +0 -14
  132. package/dist/reactiveQueries/graphql.js.map +0 -1
  133. package/dist/reactiveQueries/js.d.ts +0 -19
  134. package/dist/reactiveQueries/js.d.ts.map +0 -1
  135. package/dist/reactiveQueries/js.js +0 -13
  136. package/dist/reactiveQueries/js.js.map +0 -1
  137. package/dist/reactiveQueries/sql.d.ts +0 -31
  138. package/dist/reactiveQueries/sql.d.ts.map +0 -1
  139. package/dist/reactiveQueries/sql.js +0 -28
  140. package/dist/reactiveQueries/sql.js.map +0 -1
  141. package/dist/schema.d.ts +0 -163
  142. package/dist/schema.d.ts.map +0 -1
  143. package/dist/schema.js +0 -92
  144. package/dist/schema.js.map +0 -1
  145. package/dist/store.d.ts +0 -175
  146. package/dist/store.d.ts.map +0 -1
  147. package/dist/store.js +0 -549
  148. package/dist/store.js.map +0 -1
  149. package/dist/util.d.ts +0 -24
  150. package/dist/util.d.ts.map +0 -1
  151. package/dist/util.js +0 -51
  152. package/dist/util.js.map +0 -1
@@ -1,241 +0,0 @@
1
- /* eslint-disable prefer-arrow/prefer-arrow-functions */
2
- import { shouldNeverHappen } from '@livestore/utils';
3
- import { identity } from '@livestore/utils/effect';
4
- import initSqlJs from 'sqlite-esm';
5
- import BoundMap, { BoundArray } from './bounded-collections.js';
6
- // import { EVENTS_TABLE_NAME } from './events.js'
7
- import { sql } from './index.js';
8
- import { getDurationMsFromSpan, getStartTimeHighResFromSpan } from './otel.js';
9
- import QueryCache from './QueryCache.js';
10
- import { prepareBindValues } from './util.js';
11
- export var IndexType;
12
- (function (IndexType) {
13
- IndexType["Basic"] = "Basic";
14
- IndexType["FullText"] = "FullText";
15
- })(IndexType || (IndexType = {}));
16
- export const emptyDebugInfo = () => ({
17
- slowQueries: new BoundArray(200),
18
- queryFrameDuration: 0,
19
- queryFrameCount: 0,
20
- events: new BoundArray(1000),
21
- });
22
- export class InMemoryDatabase {
23
- constructor(db, otelTracer, otelRootSpanContext, SQL) {
24
- this.db = db;
25
- this.otelTracer = otelTracer;
26
- this.otelRootSpanContext = otelRootSpanContext;
27
- this.SQL = SQL;
28
- // TODO: how many unique active statements are expected?
29
- this.cachedStmts = new BoundMap(200);
30
- this.tablesUsedCache = new BoundMap(200);
31
- this.resultCache = new QueryCache();
32
- this.debugInfo = emptyDebugInfo();
33
- }
34
- static async load(data, otelTracer, otelRootSpanContext) {
35
- const sqlite3 = await initSqlJs({
36
- // Required to load the wasm binary asynchronously. Of course, you can host it wherever you want
37
- // You can omit locateFile completely when running in node
38
- // locateFile: () => `/sql-wasm.wasm`,
39
- print: (message) => console.log(`[sql-client] ${message}`),
40
- printErr: (message) => console.error(`[sql-client] ${message}`),
41
- });
42
- const db = new sqlite3.oo1.DB({ filename: ':memory:', flags: 'c' });
43
- db.capi = sqlite3.capi;
44
- if (data !== undefined) {
45
- // Based on https://sqlite.org/forum/forumpost/2119230da8ac5357a13b731f462dc76e08621a4a29724f7906d5f35bb8508465
46
- // TODO find cleaner way to do this once possible in sqlite3-wasm
47
- const bytes = data;
48
- const p = sqlite3.wasm.allocFromTypedArray(bytes);
49
- const _rc = sqlite3.capi.sqlite3_deserialize(db.pointer, 'main', p, bytes.length, bytes.length, sqlite3.capi.SQLITE_DESERIALIZE_FREEONCLOSE && sqlite3.capi.SQLITE_DESERIALIZE_RESIZEABLE);
50
- }
51
- return new InMemoryDatabase(db, otelTracer, otelRootSpanContext, sqlite3);
52
- }
53
- txn(callback) {
54
- this.execute(sql `begin transaction;`);
55
- let errored = false;
56
- let result;
57
- try {
58
- result = callback();
59
- }
60
- catch (e) {
61
- errored = true;
62
- this.execute(sql `rollback;`);
63
- throw e;
64
- }
65
- if (!errored) {
66
- this.execute(sql `commit;`);
67
- }
68
- return result;
69
- }
70
- getTablesUsed(query) {
71
- const cached = this.tablesUsedCache.get(query);
72
- if (cached) {
73
- return cached;
74
- }
75
- const stmt = this.db.prepare(`SELECT tbl_name FROM tables_used(?) AS u JOIN sqlite_master ON sqlite_master.name = u.name WHERE u.schema = 'main';`);
76
- const tablesUsed = [];
77
- try {
78
- stmt.bind([query]);
79
- while (stmt.step()) {
80
- tablesUsed.push(stmt.get(0));
81
- }
82
- }
83
- finally {
84
- stmt.finalize();
85
- }
86
- this.tablesUsedCache.set(query, tablesUsed);
87
- return tablesUsed;
88
- }
89
- /**
90
- * NOTE `execute` is untraced since it's usually called from `applyEvent` which is traced
91
- */
92
- execute(query, bindValues, writeTables, options) {
93
- try {
94
- let stmt = this.cachedStmts.get(query);
95
- if (stmt === undefined) {
96
- stmt = this.db.prepare(query);
97
- this.cachedStmts.set(query, stmt);
98
- }
99
- if (bindValues !== undefined && Object.keys(bindValues).length > 0) {
100
- stmt.bind(prepareBindValues(bindValues, query));
101
- }
102
- try {
103
- stmt.step();
104
- }
105
- finally {
106
- stmt.reset(); // Reset is needed for next execution
107
- }
108
- }
109
- catch (error) {
110
- shouldNeverHappen(`Error executing query: ${error} \n ${JSON.stringify({
111
- query,
112
- bindValues,
113
- })}`);
114
- }
115
- if (options?.hasNoEffects !== true && !this.resultCache.ignoreQuery(query)) {
116
- // TODO use write tables instead
117
- // check what queries actually end up here.
118
- this.resultCache.invalidate(writeTables ?? this.getTablesUsed(query));
119
- }
120
- if (options?.hasNoEffects === true) {
121
- return;
122
- }
123
- }
124
- select(query, options) {
125
- const { queriedTables, bindValues, skipCache = false, parentSpanContext } = options ?? {};
126
- return this.otelTracer.startActiveSpan('sql-in-memory-select', {}, parentSpanContext ?? this.otelRootSpanContext, (span) => {
127
- try {
128
- span.setAttribute('sql.query', query);
129
- const key = this.resultCache.getKey(query, bindValues);
130
- const cachedResult = this.resultCache.get(key);
131
- if (skipCache === false && cachedResult !== undefined) {
132
- span.setAttribute('sql.rowsCount', cachedResult.length);
133
- span.setAttribute('sql.cached', true);
134
- span.end();
135
- return cachedResult;
136
- }
137
- let stmt = this.cachedStmts.get(query);
138
- if (stmt === undefined) {
139
- stmt = this.db.prepare(query);
140
- this.cachedStmts.set(query, stmt);
141
- }
142
- if (bindValues) {
143
- stmt.bind(bindValues ?? {});
144
- }
145
- const result = [];
146
- try {
147
- const columns = stmt.getColumnNames();
148
- while (stmt.step()) {
149
- const obj = {};
150
- for (const [i, c] of columns.entries()) {
151
- obj[c] = stmt.get(i);
152
- }
153
- result.push(obj);
154
- }
155
- }
156
- finally {
157
- // we're caching statements in this iteration. do not free.
158
- // stmt.free();
159
- // reset the cached statement so we can use it again in the future
160
- stmt.reset();
161
- }
162
- span.setAttribute('sql.rowsCount', result.length);
163
- span.setAttribute('sql.cached', false);
164
- const queriedTables_ = queriedTables ?? this.getTablesUsed(query);
165
- this.resultCache.set(queriedTables_, key, result);
166
- span.end();
167
- const durationMs = getDurationMsFromSpan(span);
168
- this.debugInfo.queryFrameDuration += durationMs;
169
- this.debugInfo.queryFrameCount++;
170
- // TODO also enable in non-dev mode
171
- if (durationMs > 5 && import.meta.env.DEV) {
172
- this.debugInfo.slowQueries.push([
173
- query,
174
- bindValues,
175
- durationMs,
176
- result.length,
177
- queriedTables_,
178
- getStartTimeHighResFromSpan(span),
179
- ]);
180
- }
181
- return result;
182
- }
183
- catch (e) {
184
- span.end();
185
- console.error(query);
186
- console.error(bindValues);
187
- shouldNeverHappen(`Error executing select query: ${e} \n ${JSON.stringify({ query, bindValues })}`);
188
- }
189
- });
190
- }
191
- // TODO move `applyEvent` logic to Store and only call `execute` here
192
- applyEvent(event, eventDefinition, parentSpanContext) {
193
- return this.otelTracer.startActiveSpan('livestore.in-memory-db:applyEvent', {}, parentSpanContext, (span) => {
194
- // TODO: in the future, we'll do more CRDT-style stuff here to decide whether to run effects of the event
195
- // NOTE: These two updates should happen transactionally;
196
- // we don't create a transaction here because that's handled in the caller.
197
- // The reason for this is that sometimes we want to apply multiple events in a larger transaction.
198
- // Insert into the events table
199
- // this.execute(sql`insert into ${EVENTS_TABLE_NAME} (id, type, args) values ($id, $type, $args)`, {
200
- // id: event.id,
201
- // type: event.type,
202
- // args: JSON.stringify(event.args ?? {}),
203
- // })
204
- const statement = typeof eventDefinition.statement === 'function'
205
- ? eventDefinition.statement(event.args)
206
- : eventDefinition.statement;
207
- const prepareBindValues = eventDefinition.prepareBindValues ?? identity;
208
- const bindValues = typeof eventDefinition.statement === 'function' && statement.argsAlreadyBound
209
- ? {}
210
- : prepareBindValues(event.args);
211
- if (import.meta.env.DEV) {
212
- this.debugInfo.events.push([statement.sql, bindValues]);
213
- }
214
- // Run the effects of the event
215
- this.execute(statement.sql, bindValues, statement.writeTables);
216
- span.end();
217
- const durationMs = getDurationMsFromSpan(span);
218
- this.debugInfo.queryFrameDuration += durationMs;
219
- this.debugInfo.queryFrameCount++;
220
- if (durationMs > 5 && import.meta.env.DEV) {
221
- this.debugInfo.slowQueries.push([
222
- statement.sql,
223
- bindValues,
224
- durationMs,
225
- undefined,
226
- [],
227
- getStartTimeHighResFromSpan(span),
228
- ]);
229
- }
230
- return { durationMs };
231
- });
232
- }
233
- export() {
234
- // Clear statement cache because exporting frees statements
235
- for (const key of this.cachedStmts.keys()) {
236
- this.cachedStmts.delete(key);
237
- }
238
- return this.db.capi.sqlite3_js_db_export(this.db.pointer);
239
- }
240
- }
241
- //# sourceMappingURL=inMemoryDatabase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inMemoryDatabase.js","sourceRoot":"","sources":["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AC,SAAS,CAAC,eAAe,EAAE,CAAA;YAEhC,IAAI,UAAU,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;gBACzC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC;oBAC9B,SAAS,CAAC,GAAG;oBACb,UAAU;oBACV,UAAU;oBACV,SAAS;oBACT,EAAE;oBACF,2BAA2B,CAAC,IAAI,CAAC;iBAClC,CAAC,CAAA;aACH;YAED,OAAO,EAAE,UAAU,EAAE,CAAA;QACvB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,MAAM;QACJ,2DAA2D;QAC3D,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE;YACzC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SAC7B;QAED,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;IAC3D,CAAC;CACF"}
package/dist/index.d.ts DELETED
@@ -1,20 +0,0 @@
1
- export { Store, createStore, RESET_DB_LOCAL_STORAGE_KEY } from './store.js';
2
- export type { LiveStoreQuery, BaseGraphQLContext, QueryResult, QueryDebugInfo, RefreshReason } from './store.js';
3
- export type { QueryDefinition, LiveStoreCreateStoreOptions, LiveStoreContext } from './effect/LiveStore.js';
4
- export { defineComponentStateSchema, EVENT_CURSOR_TABLE, defineSchema, defineAction, defineActions, defineTables, defineMaterializedViews, } from './schema.js';
5
- export { InMemoryDatabase, type DebugInfo, emptyDebugInfo } from './inMemoryDatabase.js';
6
- export { createBackend, IndexType } from './backends/index.js';
7
- export type { BackendOptions, Backend, BackendType } from './backends/index.js';
8
- export { isBackendType } from './backends/index.js';
9
- export type { SelectResponse } from './backends/index.js';
10
- export { WebWorkerBackend } from './backends/web.js';
11
- export type { GetAtom, AtomDebugInfo, RefreshDebugInfo, RefreshReasonWithGenericReasons, SerializedAtom, SerializedEffect, } from './reactive.js';
12
- export type { LiveStoreJSQuery } from './reactiveQueries/js.js';
13
- export type { LiveStoreSQLQuery } from './reactiveQueries/sql.js';
14
- export type { LiveStoreGraphQLQuery } from './reactiveQueries/graphql.js';
15
- export { labelForKey } from './componentKey.js';
16
- export type { ComponentKey } from './componentKey.js';
17
- export type { Schema, TableDefinition, GetActionArgs, GetApplyEventArgs, ColumnDefinition, Index, ActionDefinition, ActionDefinitions, } from './schema.js';
18
- export { sql, type Bindable } from './util.js';
19
- export { isEqual } from 'lodash-es';
20
- //# 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,WAAW,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAC3E,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhH,YAAY,EAAE,eAAe,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE3G,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,uBAAuB,GACxB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,gBAAgB,EAAE,KAAK,SAAS,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACxF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC9D,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,YAAY,EACV,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,+BAA+B,EAC/B,cAAc,EACd,gBAAgB,GACjB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,YAAY,EACV,MAAM,EACN,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}
package/dist/index.js DELETED
@@ -1,10 +0,0 @@
1
- export { Store, createStore, RESET_DB_LOCAL_STORAGE_KEY } from './store.js';
2
- export { defineComponentStateSchema, EVENT_CURSOR_TABLE, defineSchema, defineAction, defineActions, defineTables, defineMaterializedViews, } from './schema.js';
3
- export { InMemoryDatabase, emptyDebugInfo } from './inMemoryDatabase.js';
4
- export { createBackend, IndexType } from './backends/index.js';
5
- export { isBackendType } from './backends/index.js';
6
- export { WebWorkerBackend } from './backends/web.js';
7
- export { labelForKey } from './componentKey.js';
8
- export { sql } from './util.js';
9
- export { isEqual } from 'lodash-es';
10
- //# 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,WAAW,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAK3E,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,uBAAuB,GACxB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,gBAAgB,EAAkB,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACxF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAapD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAa/C,OAAO,EAAE,GAAG,EAAiB,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}
package/dist/otel.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type * as otel from '@opentelemetry/api';
2
- export declare const TODO_REMOVE_trackLongRunningSpan: (span: otel.Span) => void;
3
- export declare const getDurationMsFromSpan: (span: otel.Span) => number;
4
- export declare const getStartTimeHighResFromSpan: (span: otel.Span) => DOMHighResTimeStamp;
5
- //# sourceMappingURL=otel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"otel.d.ts","sourceRoot":"","sources":["../src/otel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAG/C,eAAO,MAAM,gCAAgC,SAAU,KAAK,IAAI,KAAG,IAQlE,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,KAAK,IAAI,KAAG,MAGvD,CAAA;AAED,eAAO,MAAM,2BAA2B,SAAU,KAAK,IAAI,KAAG,mBACF,CAAA"}
package/dist/otel.js DELETED
@@ -1,17 +0,0 @@
1
- // TODO improve - see https://www.notion.so/schickling/Better-solution-for-globalThis-inProgressSpans-503cd7a5f4fc4fb8bdec2e60bde1be1f
2
- export const TODO_REMOVE_trackLongRunningSpan = (span) => {
3
- // @ts-expect-error TODO get rid of this coupling
4
- if (window.inProgressSpans !== undefined && window.inProgressSpans instanceof Set) {
5
- // @ts-expect-error TODO get rid of this coupling
6
- window.inProgressSpans.add(span);
7
- }
8
- else {
9
- // debugger
10
- }
11
- };
12
- export const getDurationMsFromSpan = (span) => {
13
- const durationHr = span._duration;
14
- return durationHr[0] * 1000 + durationHr[1] / 1000000;
15
- };
16
- export const getStartTimeHighResFromSpan = (span) => span._performanceStartTime;
17
- //# sourceMappingURL=otel.js.map
package/dist/otel.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"otel.js","sourceRoot":"","sources":["../src/otel.ts"],"names":[],"mappings":"AAEA,sIAAsI;AACtI,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,IAAe,EAAQ,EAAE;IACxE,iDAAiD;IACjD,IAAI,MAAM,CAAC,eAAe,KAAK,SAAS,IAAI,MAAM,CAAC,eAAe,YAAY,GAAG,EAAE;QACjF,iDAAiD;QACjD,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;KACjC;SAAM;QACL,WAAW;KACZ;AACH,CAAC,CAAA;AAED,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,OAAS,CAAA;AACzD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,IAAe,EAAuB,EAAE,CACjF,IAAY,CAAC,qBAA4C,CAAA"}
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import type { LiveStoreContext as LiveStoreContext_ } from '../effect/LiveStore.js';
3
- import type { LiveStoreQuery } from '../store.js';
4
- declare global {
5
- interface LiveStoreQueryTypes {
6
- [key: string]: LiveStoreQuery;
7
- }
8
- }
9
- export declare const LiveStoreContext: React.Context<LiveStoreContext_ | undefined>;
10
- export declare const useStore: () => LiveStoreContext_;
11
- //# sourceMappingURL=LiveStoreContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LiveStoreContext.d.ts","sourceRoot":"","sources":["../../src/react/LiveStoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,mBAAmB;QAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAC9B;CACF;AAED,eAAO,MAAM,gBAAgB,8CAAgE,CAAA;AAE7F,eAAO,MAAM,QAAQ,QAAO,iBAQ3B,CAAA"}
@@ -1,10 +0,0 @@
1
- import React, { useContext } from 'react';
2
- export const LiveStoreContext = React.createContext(undefined);
3
- export const useStore = () => {
4
- const storeContext = useContext(LiveStoreContext);
5
- if (storeContext === undefined) {
6
- throw new Error(`useStore can only be used inside StoreContext.Provider`);
7
- }
8
- return storeContext;
9
- };
10
- //# sourceMappingURL=LiveStoreContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LiveStoreContext.js","sourceRoot":"","sources":["../../src/react/LiveStoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAYzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAgC,SAAS,CAAC,CAAA;AAE7F,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAsB,EAAE;IAC9C,MAAM,YAAY,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAEjD,IAAI,YAAY,KAAK,SAAS,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;KAC1E;IAED,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA"}
@@ -1,21 +0,0 @@
1
- import type * as otel from '@opentelemetry/api';
2
- import type { ReactElement, ReactNode } from 'react';
3
- import type { Backend, BackendOptions } from '../backends/index.js';
4
- import type { GlobalQueryDefs } from '../effect/LiveStore.js';
5
- import type { Schema } from '../schema.js';
6
- import type { BaseGraphQLContext, GraphQLOptions } from '../store.js';
7
- interface LiveStoreProviderProps<GraphQLContext> {
8
- schema: Schema;
9
- backendOptions: BackendOptions;
10
- boot?: (backend: Backend, parentSpan: otel.Span) => Promise<void>;
11
- globalQueryDefs: GlobalQueryDefs;
12
- graphQLOptions?: GraphQLOptions<GraphQLContext>;
13
- otelTracer?: otel.Tracer;
14
- otelRootSpanContext?: otel.Context;
15
- fallback: ReactElement;
16
- }
17
- export declare const LiveStoreProvider: <GraphQLContext extends BaseGraphQLContext>({ fallback, globalQueryDefs, backendOptions, graphQLOptions, otelTracer, otelRootSpanContext, children, schema, boot, }: LiveStoreProviderProps<GraphQLContext> & {
18
- children?: ReactNode;
19
- }) => JSX.Element;
20
- export {};
21
- //# sourceMappingURL=LiveStoreProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LiveStoreProvider.d.ts","sourceRoot":"","sources":["../../src/react/LiveStoreProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGpD,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIrE,UAAU,sBAAsB,CAAC,cAAc;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,cAAc,CAAA;IAC9B,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjE,eAAe,EAAE,eAAe,CAAA;IAChC,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAA;IAC/C,UAAU,CAAC,EAAE,IAAI,CAAC,MAAM,CAAA;IACxB,mBAAmB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAA;IAClC,QAAQ,EAAE,YAAY,CAAA;CACvB;AAED,eAAO,MAAM,iBAAiB;eAU2B,SAAS;MAAK,WAgBtE,CAAA"}
@@ -1,48 +0,0 @@
1
- import { mapValues } from 'lodash-es';
2
- import React from 'react';
3
- import { createStore } from '../store.js';
4
- import { LiveStoreContext } from './LiveStoreContext.js';
5
- export const LiveStoreProvider = ({ fallback, globalQueryDefs, backendOptions, graphQLOptions, otelTracer, otelRootSpanContext, children, schema, boot, }) => {
6
- const store = useCreateStore({
7
- schema,
8
- globalQueryDefs,
9
- backendOptions,
10
- graphQLOptions,
11
- otelTracer,
12
- otelRootSpanContext,
13
- boot,
14
- });
15
- if (store === undefined) {
16
- return fallback;
17
- }
18
- return React.createElement(LiveStoreContext.Provider, { value: store }, children);
19
- };
20
- const useCreateStore = ({ schema, globalQueryDefs, backendOptions, graphQLOptions, otelTracer, otelRootSpanContext, boot, }) => {
21
- const [ctxValue, setCtxValue] = React.useState();
22
- React.useEffect(() => {
23
- void (async () => {
24
- try {
25
- const store = await createStore({
26
- schema,
27
- backendOptions,
28
- graphQLOptions,
29
- otelTracer,
30
- otelRootSpanContext,
31
- boot,
32
- });
33
- store.otel.tracer.startActiveSpan('LiveStore:makeGlobalQueries', {}, store.otel.queriesSpanContext, (span) => {
34
- const globalQueries = mapValues(globalQueryDefs, (queryDef) => queryDef(store));
35
- setCtxValue({ store, globalQueries });
36
- span.end();
37
- });
38
- }
39
- catch (e) {
40
- console.error(`Error creating LiveStore store:`, e);
41
- throw e;
42
- }
43
- })();
44
- // TODO: do we need to return any cleanup function here?
45
- }, [schema, backendOptions, globalQueryDefs, graphQLOptions, otelTracer, otelRootSpanContext, boot]);
46
- return ctxValue;
47
- };
48
- //# sourceMappingURL=LiveStoreProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LiveStoreProvider.js","sourceRoot":"","sources":["../../src/react/LiveStoreProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAaxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAA4C,EAC3E,QAAQ,EACR,eAAe,EACf,cAAc,EACd,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,QAAQ,EACR,MAAM,EACN,IAAI,GAC8D,EAAe,EAAE;IACnF,MAAM,KAAK,GAAG,cAAc,CAAC;QAC3B,MAAM;QACN,eAAe;QACf,cAAc;QACd,cAAc;QACd,UAAU;QACV,mBAAmB;QACnB,IAAI;KACL,CAAC,CAAA;IAEF,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,OAAO,QAAQ,CAAA;KAChB;IAED,OAAO,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAA6B,CAAA;AACxF,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,CAA4C,EACjE,MAAM,EACN,eAAe,EACf,cAAc,EACd,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,IAAI,GACwC,EAAE,EAAE;IAChD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,EAA6B,CAAA;IAE3E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,IAAI;gBACF,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC;oBAC9B,MAAM;oBACN,cAAc;oBACd,cAAc;oBACd,UAAU;oBACV,mBAAmB;oBACnB,IAAI;iBACL,CAAC,CAAA;gBACF,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,6BAA6B,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC3G,MAAM,aAAa,GAAG,SAAS,CAAC,eAAe,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;oBAC/E,WAAW,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAA;oBACrC,IAAI,CAAC,GAAG,EAAE,CAAA;gBACZ,CAAC,CAAC,CAAA;aACH;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,CAAC,CAAC,CAAA;gBACnD,MAAM,CAAC,CAAA;aACR;QACH,CAAC,CAAC,EAAE,CAAA;QAEJ,wDAAwD;IAC1D,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC,CAAA;IAEpG,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA"}
@@ -1,7 +0,0 @@
1
- export type { UseLiveStoreComponentProps as LiveStoreComponentConfig, ReactiveGraphQL, ReactiveSQL, Setters, } from './useLiveStoreComponent.js';
2
- export { LiveStoreContext, useStore } from './LiveStoreContext.js';
3
- export { LiveStoreProvider } from './LiveStoreProvider.js';
4
- export { useLiveStoreComponent } from './useLiveStoreComponent.js';
5
- export { useGraphQL } from './useGraphQL.js';
6
- export { useGlobalQuery } from './useGlobalQuery.js';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,0BAA0B,IAAI,wBAAwB,EACtD,eAAe,EACf,WAAW,EACX,OAAO,GACR,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
@@ -1,6 +0,0 @@
1
- export { LiveStoreContext, useStore } from './LiveStoreContext.js';
2
- export { LiveStoreProvider } from './LiveStoreProvider.js';
3
- export { useLiveStoreComponent } from './useLiveStoreComponent.js';
4
- export { useGraphQL } from './useGraphQL.js';
5
- export { useGlobalQuery } from './useGlobalQuery.js';
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
@@ -1,3 +0,0 @@
1
- import type { LiveStoreQuery, QueryResult } from '../store.js';
2
- export declare const useGlobalQuery: <Q extends LiveStoreQuery>(query: Q) => QueryResult<Q>;
3
- //# sourceMappingURL=useGlobalQuery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useGlobalQuery.d.ts","sourceRoot":"","sources":["../../src/react/useGlobalQuery.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9D,eAAO,MAAM,cAAc,wDAiC1B,CAAA"}
@@ -1,25 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { labelForKey } from '../componentKey.js';
3
- import { TODO_REMOVE_trackLongRunningSpan } from '../otel.js';
4
- export const useGlobalQuery = (query) => {
5
- // We know the query has a result by the time we use it; so we can synchronously populate a default state
6
- const [value, setValue] = useState(query.results$.result);
7
- // Subscribe to future updates for this query
8
- useEffect(() => {
9
- return query.store.otel.tracer.startActiveSpan(`LiveStore:useGlobalQuery:${labelForKey(query.componentKey)}:${query.label}`, {}, query.store.otel.queriesSpanContext, (span) => {
10
- TODO_REMOVE_trackLongRunningSpan(span);
11
- const cancel = query.store.subscribe(query, (v) => {
12
- // NOTE: we return a reference to the result object within LiveStore;
13
- // this implies that app code must not mutate the results, or else
14
- // there may be weird reactivity bugs.
15
- return setValue(v);
16
- }, undefined, { label: query.label });
17
- return () => {
18
- cancel();
19
- span.end();
20
- };
21
- });
22
- }, [query]);
23
- return value;
24
- };
25
- //# sourceMappingURL=useGlobalQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useGlobalQuery.js","sourceRoot":"","sources":["../../src/react/useGlobalQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAA;AAG7D,MAAM,CAAC,MAAM,cAAc,GAAG,CAA2B,KAAQ,EAAkB,EAAE;IACnF,yGAAyG;IACzG,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAiB,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAEzE,6CAA6C;IAC7C,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAC5C,4BAA4B,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,EAC5E,EAAE,EACF,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,EACnC,CAAC,IAAI,EAAE,EAAE;YACP,gCAAgC,CAAC,IAAI,CAAC,CAAA;YAEtC,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAClC,KAAK,EACL,CAAC,CAAC,EAAE,EAAE;gBACJ,qEAAqE;gBACrE,kEAAkE;gBAClE,sCAAsC;gBACtC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAA;YACpB,CAAC,EACD,SAAS,EACT,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CACvB,CAAA;YACD,OAAO,GAAG,EAAE;gBACV,MAAM,EAAE,CAAA;gBACR,IAAI,CAAC,GAAG,EAAE,CAAA;YACZ,CAAC,CAAA;QACH,CAAC,CACF,CAAA;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
@@ -1,11 +0,0 @@
1
- import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
2
- import React from 'react';
3
- import { type ComponentKeyConfig } from './useLiveStoreComponent.js';
4
- export type UseLiveStoreComponentProps<TResult extends Record<string, any>, TVariables extends Record<string, any>> = {
5
- query: DocumentNode<TResult, TVariables>;
6
- variables: TVariables;
7
- componentKey: ComponentKeyConfig;
8
- reactDeps?: React.DependencyList;
9
- };
10
- export declare const useGraphQL: <TResult extends Record<string, any>, TVariables extends Record<string, any> = {}>({ query, variables, componentKey: componentKeyConfig, reactDeps, }: UseLiveStoreComponentProps<TResult, TVariables>) => Readonly<TResult>;
11
- //# sourceMappingURL=useGraphQL.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useGraphQL.d.ts","sourceRoot":"","sources":["../../src/react/useGraphQL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAG1F,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,KAAK,kBAAkB,EAAmB,MAAM,4BAA4B,CAAA;AAGrF,MAAM,MAAM,0BAA0B,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;IACpH,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;IACxC,SAAS,EAAE,UAAU,CAAA;IACrB,YAAY,EAAE,kBAAkB,CAAA;IAChC,SAAS,CAAC,EAAE,KAAK,CAAC,cAAc,CAAA;CACjC,CAAA;AAWD,eAAO,MAAM,UAAU,8NAsFtB,CAAA"}
@@ -1,68 +0,0 @@
1
- import * as otel from '@opentelemetry/api';
2
- import { isEqual } from 'lodash-es';
3
- import React from 'react';
4
- import { labelForKey } from '../componentKey.js';
5
- import { useStore } from './LiveStoreContext.js';
6
- import { useComponentKey } from './useLiveStoreComponent.js';
7
- import { useStateRefWithReactiveInput } from './utils/useStateRefWithReactiveInput.js';
8
- /**
9
- * This is needed because the `React.useMemo` call below, can sometimes be called multiple times 🤷,
10
- * so we need to "cache" the fact that we've already started a span for this component.
11
- * The map entry is being removed again in the `React.useEffect` call below.
12
- */
13
- const spanAlreadyStartedCache = new Map();
14
- // TODO 1) figure out a way to make `variables` optional if the query doesn't have any variables (probably requires positional args)
15
- // TODO 2) allow `.pipe` on the resulting query (possibly as a separate optional prop)
16
- export const useGraphQL = ({ query, variables, componentKey: componentKeyConfig, reactDeps = [], }) => {
17
- const componentKey = useComponentKey(componentKeyConfig, reactDeps);
18
- const { store } = useStore();
19
- const componentKeyLabel = React.useMemo(() => labelForKey(componentKey), [componentKey]);
20
- // The following `React.useMemo` and `React.useEffect` calls are used to start and end a span for the lifetime of this component.
21
- const { span, otelCtx } = React.useMemo(() => {
22
- const existingSpan = spanAlreadyStartedCache.get(componentKeyLabel);
23
- if (existingSpan !== undefined)
24
- return existingSpan;
25
- const span = store.otel.tracer.startSpan(`LiveStore:useGraphQL:${componentKeyLabel}`, {}, store.otel.queriesSpanContext);
26
- const otelCtx = otel.trace.setSpan(otel.context.active(), span);
27
- spanAlreadyStartedCache.set(componentKeyLabel, { span, otelCtx });
28
- return { span, otelCtx };
29
- }, [componentKeyLabel, store.otel.queriesSpanContext, store.otel.tracer]);
30
- React.useEffect(() => () => {
31
- spanAlreadyStartedCache.delete(componentKeyLabel);
32
- span.end();
33
- }, [componentKeyLabel, span]);
34
- const makeLiveStoreQuery = React.useCallback(() => store.queryGraphQL(query, () => variables ?? {}, { componentKey }, otelCtx),
35
- // NOTE: we don't include the queries function passed in by the user here;
36
- // the reason is that we don't want to force them to memoize that function.
37
- // Instead, we just assume that the function always has the same contents.
38
- // This makes sense for LiveStore because the component config should be static.
39
- // TODO: document this and consider whether it's the right API surface.
40
- // eslint-disable-next-line react-hooks/exhaustive-deps
41
- [componentKey, store]);
42
- // TODO get rid of the temporary query workaround
43
- const initialQueryResults = React.useMemo(() => store.inTempQueryContext(() => makeLiveStoreQuery().results$.result), [makeLiveStoreQuery, store]);
44
- const [queryResultsRef, setQueryResults_] = useStateRefWithReactiveInput(initialQueryResults);
45
- React.useEffect(() => {
46
- const liveStoreQuery = makeLiveStoreQuery();
47
- const unsubscribe = store.subscribe(liveStoreQuery, (results) => {
48
- if (isEqual(results, queryResultsRef.current) === false) {
49
- setQueryResults_(results);
50
- }
51
- }, undefined, { label: `useGraphQL:query:subscribe:${liveStoreQuery.label}` });
52
- return () => {
53
- unsubscribe();
54
- };
55
- // NOTE `setQueryResults_` from the deps array as it seems to cause an infinite loop
56
- // This should probably be improved
57
- // eslint-disable-next-line react-hooks/exhaustive-deps
58
- }, [
59
- otelCtx,
60
- makeLiveStoreQuery,
61
- // setQueryResults_,
62
- store,
63
- ]);
64
- // Very important: remove any queries / other resources associated w/ this component
65
- React.useEffect(() => () => store.unmountComponent(componentKey), [store, componentKey]);
66
- return queryResultsRef.current;
67
- };
68
- //# sourceMappingURL=useGraphQL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useGraphQL.js","sourceRoot":"","sources":["../../src/react/useGraphQL.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAA2B,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACrF,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAA;AAStF;;;;GAIG;AACH,MAAM,uBAAuB,GAAG,IAAI,GAAG,EAAsD,CAAA;AAE7F,oIAAoI;AACpI,sFAAsF;AACtF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAmF,EAC3G,KAAK,EACL,SAAS,EACT,YAAY,EAAE,kBAAkB,EAChC,SAAS,GAAG,EAAE,GACkC,EAAqB,EAAE;IACvE,MAAM,YAAY,GAAG,eAAe,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAA;IACnE,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE5B,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;IAExF,iIAAiI;IACjI,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC3C,MAAM,YAAY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