@livestore/livestore 0.0.24 → 0.0.27

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 (243) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/QueryCache.d.ts +3 -3
  3. package/dist/QueryCache.d.ts.map +1 -1
  4. package/dist/QueryCache.js +50 -60
  5. package/dist/QueryCache.js.map +1 -1
  6. package/dist/__tests__/react/fixture.d.ts +22 -7
  7. package/dist/__tests__/react/fixture.d.ts.map +1 -1
  8. package/dist/__tests__/react/fixture.js +14 -15
  9. package/dist/__tests__/react/fixture.js.map +1 -1
  10. package/dist/__tests__/react/useQuery.test.js +37 -12
  11. package/dist/__tests__/react/useQuery.test.js.map +1 -1
  12. package/dist/__tests__/react/useRow.test.d.ts +2 -0
  13. package/dist/__tests__/react/useRow.test.d.ts.map +1 -0
  14. package/dist/__tests__/react/useRow.test.js +131 -0
  15. package/dist/__tests__/react/useRow.test.js.map +1 -0
  16. package/dist/__tests__/react/utils/stack-info.test.js +32 -0
  17. package/dist/__tests__/react/utils/stack-info.test.js.map +1 -1
  18. package/dist/__tests__/reactive.test.js +51 -0
  19. package/dist/__tests__/reactive.test.js.map +1 -1
  20. package/dist/__tests__/reactiveQueries/sql.test.js +6 -13
  21. package/dist/__tests__/reactiveQueries/sql.test.js.map +1 -1
  22. package/dist/effect/LiveStore.d.ts +3 -3
  23. package/dist/effect/LiveStore.d.ts.map +1 -1
  24. package/dist/effect/LiveStore.js +2 -2
  25. package/dist/effect/LiveStore.js.map +1 -1
  26. package/dist/global-state.d.ts +19 -0
  27. package/dist/global-state.d.ts.map +1 -0
  28. package/dist/global-state.js +20 -0
  29. package/dist/global-state.js.map +1 -0
  30. package/dist/inMemoryDatabase.d.ts +6 -6
  31. package/dist/inMemoryDatabase.d.ts.map +1 -1
  32. package/dist/inMemoryDatabase.js +16 -10
  33. package/dist/inMemoryDatabase.js.map +1 -1
  34. package/dist/index.d.ts +9 -13
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +7 -8
  37. package/dist/index.js.map +1 -1
  38. package/dist/migrations.d.ts +4 -4
  39. package/dist/migrations.d.ts.map +1 -1
  40. package/dist/migrations.js +34 -28
  41. package/dist/migrations.js.map +1 -1
  42. package/dist/react/LiveStoreContext.js.map +1 -1
  43. package/dist/react/LiveStoreProvider.d.ts +2 -2
  44. package/dist/react/LiveStoreProvider.d.ts.map +1 -1
  45. package/dist/react/LiveStoreProvider.js.map +1 -1
  46. package/dist/react/index.d.ts +1 -2
  47. package/dist/react/index.d.ts.map +1 -1
  48. package/dist/react/index.js +1 -1
  49. package/dist/react/index.js.map +1 -1
  50. package/dist/react/useQuery.d.ts +3 -0
  51. package/dist/react/useQuery.d.ts.map +1 -1
  52. package/dist/react/useQuery.js +7 -6
  53. package/dist/react/useQuery.js.map +1 -1
  54. package/dist/react/useRow.d.ts +33 -0
  55. package/dist/react/useRow.d.ts.map +1 -0
  56. package/dist/react/useRow.js +136 -0
  57. package/dist/react/useRow.js.map +1 -0
  58. package/dist/react/useTemporaryQuery.d.ts +2 -0
  59. package/dist/react/useTemporaryQuery.d.ts.map +1 -1
  60. package/dist/react/useTemporaryQuery.js +28 -11
  61. package/dist/react/useTemporaryQuery.js.map +1 -1
  62. package/dist/react/utils/stack-info.d.ts.map +1 -1
  63. package/dist/react/utils/stack-info.js +3 -3
  64. package/dist/react/utils/stack-info.js.map +1 -1
  65. package/dist/react/utils/useStateRefWithReactiveInput.js.map +1 -1
  66. package/dist/reactive.d.ts +38 -29
  67. package/dist/reactive.d.ts.map +1 -1
  68. package/dist/reactive.js +73 -45
  69. package/dist/reactive.js.map +1 -1
  70. package/dist/reactiveQueries/base-class.d.ts +10 -6
  71. package/dist/reactiveQueries/base-class.d.ts.map +1 -1
  72. package/dist/reactiveQueries/base-class.js +11 -12
  73. package/dist/reactiveQueries/base-class.js.map +1 -1
  74. package/dist/reactiveQueries/graphql.d.ts +2 -2
  75. package/dist/reactiveQueries/graphql.d.ts.map +1 -1
  76. package/dist/reactiveQueries/graphql.js +56 -50
  77. package/dist/reactiveQueries/graphql.js.map +1 -1
  78. package/dist/reactiveQueries/js.d.ts +7 -3
  79. package/dist/reactiveQueries/js.d.ts.map +1 -1
  80. package/dist/reactiveQueries/js.js +25 -15
  81. package/dist/reactiveQueries/js.js.map +1 -1
  82. package/dist/reactiveQueries/sql.d.ts +5 -5
  83. package/dist/reactiveQueries/sql.d.ts.map +1 -1
  84. package/dist/reactiveQueries/sql.js +39 -34
  85. package/dist/reactiveQueries/sql.js.map +1 -1
  86. package/dist/row-query.d.ts +21 -0
  87. package/dist/row-query.d.ts.map +1 -0
  88. package/dist/row-query.js +77 -0
  89. package/dist/row-query.js.map +1 -0
  90. package/dist/schema/action.d.ts +30 -0
  91. package/dist/schema/action.d.ts.map +1 -0
  92. package/dist/schema/action.js +3 -0
  93. package/dist/schema/action.js.map +1 -0
  94. package/dist/schema/index.d.ts +28 -0
  95. package/dist/schema/index.d.ts.map +1 -0
  96. package/dist/schema/index.js +26 -0
  97. package/dist/schema/index.js.map +1 -0
  98. package/dist/schema/system-tables.d.ts +24 -0
  99. package/dist/schema/system-tables.d.ts.map +1 -0
  100. package/dist/schema/system-tables.js +11 -0
  101. package/dist/schema/system-tables.js.map +1 -0
  102. package/dist/schema/table-def.d.ts +161 -0
  103. package/dist/schema/table-def.d.ts.map +1 -0
  104. package/dist/schema/table-def.js +53 -0
  105. package/dist/schema/table-def.js.map +1 -0
  106. package/dist/storage/in-memory/index.d.ts +1 -1
  107. package/dist/storage/in-memory/index.d.ts.map +1 -1
  108. package/dist/storage/in-memory/index.js +6 -7
  109. package/dist/storage/in-memory/index.js.map +1 -1
  110. package/dist/storage/index.d.ts +1 -1
  111. package/dist/storage/index.d.ts.map +1 -1
  112. package/dist/storage/tauri/index.d.ts +1 -1
  113. package/dist/storage/tauri/index.d.ts.map +1 -1
  114. package/dist/storage/tauri/index.js +25 -23
  115. package/dist/storage/tauri/index.js.map +1 -1
  116. package/dist/storage/utils/idb.js +3 -1
  117. package/dist/storage/utils/idb.js.map +1 -1
  118. package/dist/storage/web-worker/index.d.ts +1 -1
  119. package/dist/storage/web-worker/index.d.ts.map +1 -1
  120. package/dist/storage/web-worker/index.js +38 -34
  121. package/dist/storage/web-worker/index.js.map +1 -1
  122. package/dist/storage/web-worker/worker.d.ts +1 -1
  123. package/dist/storage/web-worker/worker.d.ts.map +1 -1
  124. package/dist/storage/web-worker/worker.js +1 -1
  125. package/dist/storage/web-worker/worker.js.map +1 -1
  126. package/dist/store.d.ts +11 -21
  127. package/dist/store.d.ts.map +1 -1
  128. package/dist/store.js +284 -272
  129. package/dist/store.js.map +1 -1
  130. package/dist/utils/bounded-collections.d.ts.map +1 -0
  131. package/dist/utils/bounded-collections.js +90 -0
  132. package/dist/utils/bounded-collections.js.map +1 -0
  133. package/dist/utils/otel.d.ts.map +1 -0
  134. package/dist/{otel.js → utils/otel.js} +1 -1
  135. package/dist/utils/otel.js.map +1 -0
  136. package/dist/utils/util.d.ts.map +1 -0
  137. package/dist/utils/util.js.map +1 -0
  138. package/package.json +21 -18
  139. package/src/QueryCache.ts +4 -4
  140. package/src/__tests__/react/fixture.tsx +17 -17
  141. package/src/__tests__/react/useQuery.test.tsx +56 -14
  142. package/src/__tests__/react/useRow.test.tsx +205 -0
  143. package/src/__tests__/react/utils/stack-info.test.ts +34 -0
  144. package/src/__tests__/reactive.test.ts +71 -0
  145. package/src/__tests__/reactiveQueries/sql.test.ts +6 -13
  146. package/src/effect/LiveStore.ts +7 -7
  147. package/src/global-state.ts +26 -0
  148. package/src/inMemoryDatabase.ts +14 -12
  149. package/src/index.ts +22 -29
  150. package/src/migrations.ts +41 -35
  151. package/src/react/LiveStoreProvider.tsx +2 -2
  152. package/src/react/index.ts +7 -9
  153. package/src/react/useQuery.ts +12 -6
  154. package/src/react/useRow.ts +221 -0
  155. package/src/react/useTemporaryQuery.ts +43 -11
  156. package/src/react/utils/stack-info.ts +4 -3
  157. package/src/reactive.ts +81 -65
  158. package/src/reactiveQueries/base-class.ts +14 -10
  159. package/src/reactiveQueries/graphql.ts +4 -3
  160. package/src/reactiveQueries/js.ts +9 -5
  161. package/src/reactiveQueries/sql.ts +9 -9
  162. package/src/row-query.ts +142 -0
  163. package/src/schema/action.ts +41 -0
  164. package/src/schema/index.ts +63 -0
  165. package/src/schema/system-tables.ts +21 -0
  166. package/src/schema/table-def.ts +199 -0
  167. package/src/storage/in-memory/index.ts +1 -1
  168. package/src/storage/index.ts +2 -1
  169. package/src/storage/tauri/index.ts +2 -2
  170. package/src/storage/web-worker/index.ts +1 -1
  171. package/src/storage/web-worker/worker.ts +2 -2
  172. package/src/store.ts +51 -51
  173. package/dist/__tests__/react/useComponentState.test.d.ts +0 -2
  174. package/dist/__tests__/react/useComponentState.test.d.ts.map +0 -1
  175. package/dist/__tests__/react/useComponentState.test.js +0 -68
  176. package/dist/__tests__/react/useComponentState.test.js.map +0 -1
  177. package/dist/__tests__/react/useLQuery.test.d.ts +0 -2
  178. package/dist/__tests__/react/useLQuery.test.d.ts.map +0 -1
  179. package/dist/__tests__/react/useLQuery.test.js +0 -38
  180. package/dist/__tests__/react/useLQuery.test.js.map +0 -1
  181. package/dist/__tests__/react/useLiveStoreComponent.test.d.ts +0 -2
  182. package/dist/__tests__/react/useLiveStoreComponent.test.d.ts.map +0 -1
  183. package/dist/__tests__/react/useLiveStoreComponent.test.js +0 -73
  184. package/dist/__tests__/react/useLiveStoreComponent.test.js.map +0 -1
  185. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.d.ts +0 -2
  186. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.d.ts.map +0 -1
  187. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.js +0 -38
  188. package/dist/__tests__/react/utils/extractStackInfoFromStackTrace.test.js.map +0 -1
  189. package/dist/bounded-collections.d.ts.map +0 -1
  190. package/dist/bounded-collections.js +0 -103
  191. package/dist/bounded-collections.js.map +0 -1
  192. package/dist/componentKey.d.ts +0 -20
  193. package/dist/componentKey.d.ts.map +0 -1
  194. package/dist/componentKey.js +0 -3
  195. package/dist/componentKey.js.map +0 -1
  196. package/dist/otel.d.ts.map +0 -1
  197. package/dist/otel.js.map +0 -1
  198. package/dist/react/useComponentState.d.ts +0 -50
  199. package/dist/react/useComponentState.d.ts.map +0 -1
  200. package/dist/react/useComponentState.js +0 -240
  201. package/dist/react/useComponentState.js.map +0 -1
  202. package/dist/react/useGlobalQuery.d.ts +0 -3
  203. package/dist/react/useGlobalQuery.d.ts.map +0 -1
  204. package/dist/react/useGlobalQuery.js +0 -26
  205. package/dist/react/useGlobalQuery.js.map +0 -1
  206. package/dist/react/useGraphQL.d.ts +0 -13
  207. package/dist/react/useGraphQL.d.ts.map +0 -1
  208. package/dist/react/useGraphQL.js +0 -87
  209. package/dist/react/useGraphQL.js.map +0 -1
  210. package/dist/react/useLiveStoreComponent.d.ts +0 -75
  211. package/dist/react/useLiveStoreComponent.d.ts.map +0 -1
  212. package/dist/react/useLiveStoreComponent.js +0 -361
  213. package/dist/react/useLiveStoreComponent.js.map +0 -1
  214. package/dist/react/utils/extractNamesFromStackTrace.d.ts +0 -3
  215. package/dist/react/utils/extractNamesFromStackTrace.d.ts.map +0 -1
  216. package/dist/react/utils/extractNamesFromStackTrace.js +0 -40
  217. package/dist/react/utils/extractNamesFromStackTrace.js.map +0 -1
  218. package/dist/react/utils/extractStackInfoFromStackTrace.d.ts +0 -7
  219. package/dist/react/utils/extractStackInfoFromStackTrace.d.ts.map +0 -1
  220. package/dist/react/utils/extractStackInfoFromStackTrace.js +0 -40
  221. package/dist/react/utils/extractStackInfoFromStackTrace.js.map +0 -1
  222. package/dist/reactiveQueries/graph.d.ts +0 -10
  223. package/dist/reactiveQueries/graph.d.ts.map +0 -1
  224. package/dist/reactiveQueries/graph.js +0 -6
  225. package/dist/reactiveQueries/graph.js.map +0 -1
  226. package/dist/schema.d.ts +0 -81
  227. package/dist/schema.d.ts.map +0 -1
  228. package/dist/schema.js +0 -46
  229. package/dist/schema.js.map +0 -1
  230. package/dist/util.d.ts.map +0 -1
  231. package/dist/util.js.map +0 -1
  232. package/src/__tests__/react/useComponentState.test.tsx +0 -100
  233. package/src/componentKey.ts +0 -9
  234. package/src/react/useComponentState.ts +0 -404
  235. package/src/reactiveQueries/graph.ts +0 -15
  236. package/src/schema.ts +0 -143
  237. /package/dist/{bounded-collections.d.ts → utils/bounded-collections.d.ts} +0 -0
  238. /package/dist/{otel.d.ts → utils/otel.d.ts} +0 -0
  239. /package/dist/{util.d.ts → utils/util.d.ts} +0 -0
  240. /package/dist/{util.js → utils/util.js} +0 -0
  241. /package/src/{bounded-collections.ts → utils/bounded-collections.ts} +0 -0
  242. /package/src/{otel.ts → utils/otel.ts} +0 -0
  243. /package/src/{util.ts → utils/util.ts} +0 -0
package/src/store.ts CHANGED
@@ -5,24 +5,21 @@ import type { GraphQLSchema } from 'graphql'
5
5
  import type * as Sqlite from 'sqlite-esm'
6
6
  import { v4 as uuid } from 'uuid'
7
7
 
8
- import type { ComponentKey } from './componentKey.js'
9
- import { tableNameForComponentKey } from './componentKey.js'
10
8
  import type { LiveStoreEvent } from './events.js'
9
+ import { dbGraph, dynamicallyRegisteredTables } from './global-state.js'
11
10
  import { InMemoryDatabase } from './inMemoryDatabase.js'
12
11
  import { migrateDb } from './migrations.js'
13
- import { getDurationMsFromSpan } from './otel.js'
14
12
  import type { StackInfo } from './react/utils/stack-info.js'
15
- import type { ReactiveGraph, Ref } from './reactive.js'
16
- import type { ILiveStoreQuery } from './reactiveQueries/base-class.js'
17
- import { type DbContext, dbGraph } from './reactiveQueries/graph.js'
13
+ import type { DebugRefreshReasonBase, ReactiveGraph, Ref } from './reactive.js'
14
+ import type { DbContext, ILiveStoreQuery } from './reactiveQueries/base-class.js'
18
15
  import type { LiveStoreGraphQLQuery } from './reactiveQueries/graphql.js'
19
16
  import type { LiveStoreJSQuery } from './reactiveQueries/js.js'
20
17
  import type { LiveStoreSQLQuery } from './reactiveQueries/sql.js'
21
- import type { ActionDefinition, GetActionArgs, Schema, SQLWriteStatement } from './schema.js'
22
- import { componentStateTables } from './schema.js'
18
+ import type { ActionDefinition, GetActionArgs, LiveStoreSchema, SQLWriteStatement } from './schema/index.js'
23
19
  import type { Storage, StorageInit } from './storage/index.js'
24
- import type { ParamsObject } from './util.js'
25
- import { isPromise, prepareBindValues, sql } from './util.js'
20
+ import { getDurationMsFromSpan } from './utils/otel.js'
21
+ import type { ParamsObject } from './utils/util.js'
22
+ import { isPromise, prepareBindValues, sql } from './utils/util.js'
26
23
 
27
24
  export type LiveStoreQuery<TResult extends Record<string, any> = any> =
28
25
  | LiveStoreSQLQuery<TResult>
@@ -38,10 +35,10 @@ export type BaseGraphQLContext = {
38
35
  export type QueryResult<TQuery> = TQuery extends LiveStoreSQLQuery<infer R>
39
36
  ? ReadonlyArray<Readonly<R>>
40
37
  : TQuery extends LiveStoreJSQuery<infer S>
41
- ? Readonly<S>
42
- : TQuery extends LiveStoreGraphQLQuery<infer Result, any, any>
43
- ? Readonly<Result>
44
- : never
38
+ ? Readonly<S>
39
+ : TQuery extends LiveStoreGraphQLQuery<infer Result, any, any>
40
+ ? Readonly<Result>
41
+ : never
45
42
 
46
43
  export type GraphQLOptions<TContext> = {
47
44
  schema: GraphQLSchema
@@ -52,7 +49,7 @@ export type StoreOptions<TGraphQLContext extends BaseGraphQLContext> = {
52
49
  db: InMemoryDatabase
53
50
  /** A `Proxy`d version of `db` except that it also mirrors `execute` calls to the storage */
54
51
  dbProxy: InMemoryDatabase
55
- schema: Schema
52
+ schema: LiveStoreSchema
56
53
  storage?: Storage
57
54
  graphQLOptions?: GraphQLOptions<TGraphQLContext>
58
55
  otelTracer: otel.Tracer
@@ -60,6 +57,7 @@ export type StoreOptions<TGraphQLContext extends BaseGraphQLContext> = {
60
57
  }
61
58
 
62
59
  export type RefreshReason =
60
+ | DebugRefreshReasonBase
63
61
  | {
64
62
  _tag: 'applyEvent'
65
63
  /** The event that was applied */
@@ -68,7 +66,7 @@ export type RefreshReason =
68
66
  event: Omit<LiveStoreEvent, 'id'>
69
67
 
70
68
  /** The tables that were written to by the event */
71
- writeTables: string[]
69
+ writeTables: ReadonlyArray<string>
72
70
  }
73
71
  | {
74
72
  _tag: 'applyEvents'
@@ -78,13 +76,7 @@ export type RefreshReason =
78
76
  events: Omit<LiveStoreEvent, 'id'>[]
79
77
 
80
78
  /** The tables that were written to by the event */
81
- writeTables: string[]
82
- }
83
- /** Usually in response to some `applyEvent`/`applyEvents` with `skipRefresh: true` */
84
- | { _tag: 'manualRefresh' }
85
- | {
86
- _tag: 'makeThunk'
87
- label?: string
79
+ writeTables: ReadonlyArray<string>
88
80
  }
89
81
  | {
90
82
  _tag: 'react'
@@ -93,7 +85,6 @@ export type RefreshReason =
93
85
  stackInfo?: StackInfo
94
86
  }
95
87
  | { _tag: 'manual'; label?: string }
96
- | { _tag: 'unknown' }
97
88
 
98
89
  export type QueryDebugInfo = {
99
90
  _tag: 'graphql' | 'sql' | 'js' | 'unknown'
@@ -113,7 +104,7 @@ export class Store<TGraphQLContext extends BaseGraphQLContext = BaseGraphQLConte
113
104
  inMemoryDB: InMemoryDatabase
114
105
  // TODO refactor
115
106
  _proxyDb: InMemoryDatabase
116
- schema: Schema
107
+ schema: LiveStoreSchema
117
108
  graphQLSchema?: GraphQLSchema
118
109
  graphQLContext?: TGraphQLContext
119
110
  otel: StoreOtel
@@ -160,11 +151,12 @@ export class Store<TGraphQLContext extends BaseGraphQLContext = BaseGraphQLConte
160
151
  queriesSpanContext: otelQueriesSpanContext,
161
152
  }
162
153
 
163
- const allTableNames = [
164
- ...Object.keys(this.schema.tables),
165
- ...Object.keys(this.schema.materializedViews),
166
- ...Object.keys(componentStateTables),
167
- ]
154
+ // Need a set here since `schema.tables` might contain duplicates and some componentStateTables
155
+ const allTableNames = new Set([
156
+ ...this.schema.tables.keys(),
157
+ // TODO activate dynamic tables
158
+ ...Array.from(dynamicallyRegisteredTables.values()).map((_) => _.schema.name),
159
+ ])
168
160
  for (const tableName of allTableNames) {
169
161
  this.tableRefs[tableName] = this.graph.makeRef(null, {
170
162
  equal: () => false,
@@ -205,7 +197,7 @@ export class Store<TGraphQLContext extends BaseGraphQLContext = BaseGraphQLConte
205
197
  ): (() => void) =>
206
198
  this.otel.tracer.startActiveSpan(
207
199
  `LiveStore.subscribe`,
208
- { attributes: { label: options?.label } },
200
+ { attributes: { label: options?.label, queryLabel: query.label } },
209
201
  options?.otelContext ?? this.otel.queriesSpanContext,
210
202
  (span) => {
211
203
  const otelContext = otel.trace.setSpan(otel.context.active(), span)
@@ -383,12 +375,7 @@ export class Store<TGraphQLContext extends BaseGraphQLContext = BaseGraphQLConte
383
375
  writeTables: [...writeTables],
384
376
  }
385
377
  // Update all table refs together in a batch, to only trigger one reactive update
386
- this.graph.setRefs(tablesToUpdate, { debugRefreshReason, otelContext })
387
-
388
- if (skipRefresh === false) {
389
- // TODO update the graph
390
- // this.graph.refresh({ debugRefreshReason, otelHint: 'applyEvents' }, otelContext)
391
- }
378
+ this.graph.setRefs(tablesToUpdate, { debugRefreshReason, otelContext, skipRefresh })
392
379
  } catch (e: any) {
393
380
  span.setStatus({ code: otel.SpanStatusCode.ERROR, message: e.toString() })
394
381
  } finally {
@@ -411,9 +398,8 @@ export class Store<TGraphQLContext extends BaseGraphQLContext = BaseGraphQLConte
411
398
  { attributes: { 'livestore.manualRefreshLabel': label } },
412
399
  this.otel.applyEventsSpanContext,
413
400
  (span) => {
414
- // const otelContext = otel.trace.setSpan(otel.context.active(), span)
415
- // TODO update the graph
416
- // this.graph.refresh({ otelHint: 'manualRefresh', debugRefreshReason: { _tag: 'manualRefresh' } }, otelContext)
401
+ const otelContext = otel.trace.setSpan(otel.context.active(), span)
402
+ this.graph.runDeferredEffects({ otelContext })
417
403
  span.end()
418
404
  },
419
405
  )
@@ -429,7 +415,7 @@ export class Store<TGraphQLContext extends BaseGraphQLContext = BaseGraphQLConte
429
415
  eventType: string,
430
416
  args: any = {},
431
417
  otelContext: otel.Context,
432
- ): { writeTables: string[]; durationMs: number } => {
418
+ ): { writeTables: ReadonlyArray<string>; durationMs: number } => {
433
419
  return this.otel.tracer.startActiveSpan(
434
420
  'LiveStore:applyEventWithoutRefresh',
435
421
  {
@@ -446,26 +432,35 @@ export class Store<TGraphQLContext extends BaseGraphQLContext = BaseGraphQLConte
446
432
  ...this.schema.actions,
447
433
 
448
434
  // Special LiveStore:defined actions
449
- updateComponentState: {
450
- statement: ({ componentKey, columnNames }: { componentKey: ComponentKey; columnNames: string[] }) => {
451
- const whereClause = componentKey._tag === 'singleton' ? '' : `where id = '${componentKey.id}'`
435
+ 'livestore.UpdateComponentState': {
436
+ statement: ({
437
+ id,
438
+ columnNames,
439
+ tableName,
440
+ }: {
441
+ id?: string
442
+ columnNames: ReadonlyArray<string>
443
+ tableName: string
444
+ }) => {
445
+ const whereClause = id === undefined ? '' : `where id = '${id}'`
452
446
  const updateClause = columnNames.map((columnName) => `${columnName} = $${columnName}`).join(', ')
453
- const stmt = sql`update ${tableNameForComponentKey(componentKey)} set ${updateClause} ${whereClause}`
447
+ const stmt = sql`update ${tableName} set ${updateClause} ${whereClause}`
454
448
 
455
449
  return {
456
450
  sql: stmt,
457
- writeTables: [tableNameForComponentKey(componentKey)],
451
+ writeTables: [tableName],
458
452
  }
459
453
  },
454
+ prepareBindValues: ({ bindValues }) => bindValues ?? {},
460
455
  },
461
456
 
462
- RawSql: {
463
- statement: ({ sql, writeTables }: { sql: string; writeTables: string[] }) => ({
457
+ 'livestore.RawSql': {
458
+ statement: ({ sql, writeTables }: { sql: string; writeTables: ReadonlyArray<string> }) => ({
464
459
  sql,
465
460
  writeTables,
466
461
  argsAlreadyBound: false,
467
462
  }),
468
- prepareBindValues: ({ bindValues }) => bindValues,
463
+ prepareBindValues: ({ bindValues }) => bindValues ?? {},
469
464
  },
470
465
  }
471
466
 
@@ -512,7 +507,12 @@ export class Store<TGraphQLContext extends BaseGraphQLContext = BaseGraphQLConte
512
507
  * This should only be used for framework-internal purposes;
513
508
  * all app writes should go through applyEvent.
514
509
  */
515
- execute = (query: string, params: ParamsObject = {}, writeTables?: string[], otelContext?: otel.Context) => {
510
+ execute = (
511
+ query: string,
512
+ params: ParamsObject = {},
513
+ writeTables?: ReadonlyArray<string>,
514
+ otelContext?: otel.Context,
515
+ ) => {
516
516
  this.inMemoryDB.execute(query, prepareBindValues(params, query), writeTables, { otelContext })
517
517
 
518
518
  if (this.storage !== undefined) {
@@ -532,7 +532,7 @@ export const createStore = async <TGraphQLContext extends BaseGraphQLContext>({
532
532
  boot,
533
533
  sqlite3,
534
534
  }: {
535
- schema: Schema
535
+ schema: LiveStoreSchema
536
536
  loadStorage: () => StorageInit | Promise<StorageInit>
537
537
  graphQLOptions?: GraphQLOptions<TGraphQLContext>
538
538
  otelTracer?: otel.Tracer
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=useComponentState.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useComponentState.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/react/useComponentState.test.tsx"],"names":[],"mappings":""}
@@ -1,68 +0,0 @@
1
- import { act, renderHook } from '@testing-library/react';
2
- import { describe, expect, it } from 'vitest';
3
- import { sql } from '../../index.js';
4
- import * as LiveStoreReact from '../../react/index.js';
5
- import { makeTodoMvc } from './fixture.js';
6
- describe('useComponentState', () => {
7
- it('should update the data based on component key', async () => {
8
- let renderCount = 0;
9
- const { wrapper, AppSchema, store } = await makeTodoMvc();
10
- const { result, rerender } = renderHook((userId) => {
11
- renderCount++;
12
- return LiveStoreReact.useComponentState({
13
- schema: AppSchema,
14
- componentKey: { name: 'UserInfo', id: userId },
15
- });
16
- }, { wrapper, initialProps: 'u1' });
17
- expect(result.current.state.id).toBe('u1');
18
- expect(result.current.state.username).toBe('');
19
- expect(renderCount).toBe(1);
20
- act(() => {
21
- void store.execute(sql `INSERT INTO components__UserInfo (id, username) VALUES ('u2', 'username_u2');`);
22
- });
23
- rerender('u2');
24
- expect(result.current.state.id).toBe('u2');
25
- expect(result.current.state.username).toBe('username_u2');
26
- expect(renderCount).toBe(2);
27
- });
28
- it('should update the data reactively - via setState', async () => {
29
- let renderCount = 0;
30
- const { wrapper, AppSchema } = await makeTodoMvc();
31
- const { result } = renderHook((userId) => {
32
- renderCount++;
33
- return LiveStoreReact.useComponentState({
34
- schema: AppSchema,
35
- componentKey: { name: 'UserInfo', id: userId },
36
- });
37
- }, { wrapper, initialProps: 'u1' });
38
- expect(result.current.state.id).toBe('u1');
39
- expect(result.current.state.username).toBe('');
40
- expect(renderCount).toBe(1);
41
- act(() => result.current.setState.username('username_u1_hello'));
42
- expect(result.current.state.id).toBe('u1');
43
- expect(result.current.state.username).toBe('username_u1_hello');
44
- expect(renderCount).toBe(2);
45
- });
46
- it('should update the data reactively - via raw store update', async () => {
47
- let renderCount = 0;
48
- const { wrapper, AppSchema, store } = await makeTodoMvc();
49
- const { result } = renderHook((userId) => {
50
- renderCount++;
51
- return LiveStoreReact.useComponentState({
52
- schema: AppSchema,
53
- componentKey: { name: 'UserInfo', id: userId },
54
- });
55
- }, { wrapper, initialProps: 'u1' });
56
- expect(result.current.state.id).toBe('u1');
57
- expect(result.current.state.username).toBe('');
58
- expect(renderCount).toBe(1);
59
- act(() => result.current.setState.username('username_u1_hello'));
60
- act(() => {
61
- void store.execute(sql `UPDATE components__UserInfo SET username = 'username_u1_hello' WHERE id = 'u1';`);
62
- });
63
- expect(result.current.state.id).toBe('u1');
64
- expect(result.current.state.username).toBe('username_u1_hello');
65
- expect(renderCount).toBe(2);
66
- });
67
- });
68
- //# sourceMappingURL=useComponentState.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useComponentState.test.js","sourceRoot":"","sources":["../../../src/__tests__/react/useComponentState.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,M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,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;QAC/D,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=useLQuery.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLQuery.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/react/useLQuery.test.tsx"],"names":[],"mappings":""}
@@ -1,38 +0,0 @@
1
- import { makeNoopTracer } from '@livestore/utils';
2
- import * as otel from '@opentelemetry/api';
3
- import { renderHook } from '@testing-library/react';
4
- import { describe, it } from 'vitest';
5
- import * as LiveStoreReact from '../../react/index.js';
6
- import { LiveStoreSQLQuery } from '../../reactiveQueries/sql.js';
7
- import { makeTodoMvc } from './fixture.js';
8
- describe.only('useQuery', () => {
9
- it('todo', async () => {
10
- let renderCount = 0;
11
- const { wrapper, AppSchema, store } = await makeTodoMvc();
12
- const { result, rerender } = renderHook((userId) => {
13
- renderCount++;
14
- const query = new LiveStoreSQLQuery({
15
- label: 'todo',
16
- otelContext: otel.context.active(),
17
- otelTracer: makeNoopTracer(),
18
- payload: {
19
- genQueryString: `select * from todos`,
20
- queriedTables: ['todos'],
21
- },
22
- });
23
- return LiveStoreReact.useQuery(query);
24
- }, { wrapper, initialProps: 'u1' });
25
- console.log(result.current);
26
- // expect(result.current.state.id).toBe('u1')
27
- // expect(result.current.state.username).toBe('')
28
- // expect(renderCount).toBe(1)
29
- // act(() => {
30
- // void store.execute(sql`INSERT INTO components__UserInfo (id, username) VALUES ('u2', 'username_u2');`)
31
- // })
32
- // rerender('u2')
33
- // expect(result.current.state.id).toBe('u2')
34
- // expect(result.current.state.username).toBe('username_u2')
35
- // expect(renderCount).toBe(2)
36
- });
37
- });
38
- //# sourceMappingURL=useLQuery.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLQuery.test.js","sourceRoot":"","sources":["../../../src/__tests__/react/useLQuery.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAO,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAU,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE;QACpB,IAAI,WAAW,GAAG,CAAC,CAAA;QAEnB,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,WAAW,EAAE,CAAA;QAEzD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CACrC,CAAC,MAAc,EAAE,EAAE;YACjB,WAAW,EAAE,CAAA;YAEb,MAAM,KAAK,GAAG,IAAI,iBAAiB,CAAO;gBACxC,KAAK,EAAE,MAAM;gBACb,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;gBAClC,UAAU,EAAE,cAAc,EAAE;gBAC5B,OAAO,EAAE;oBACP,cAAc,EAAE,qBAAqB;oBACrC,aAAa,EAAE,CAAC,OAAO,CAAC;iBACzB;aACF,CAAC,CAAA;YAEF,OAAO,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,EACD,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAChC,CAAA;QAED,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAE3B,6CAA6C;QAC7C,iDAAiD;QACjD,8BAA8B;QAE9B,cAAc;QACd,2GAA2G;QAC3G,KAAK;QAEL,iBAAiB;QAEjB,6CAA6C;QAC7C,4DAA4D;QAC5D,8BAA8B;IAChC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=useLiveStoreComponent.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLiveStoreComponent.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/react/useLiveStoreComponent.test.tsx"],"names":[],"mappings":""}
@@ -1,73 +0,0 @@
1
- import { act, renderHook } from '@testing-library/react';
2
- import { describe, expect, it } from 'vitest';
3
- import { sql } from '../../index.js';
4
- import * as LiveStoreReact from '../../react/index.js';
5
- import { makeTodoMvc } from './fixture.js';
6
- describe('useLiveStoreComponent', () => {
7
- it('should update the data based on component key', async () => {
8
- let renderCount = 0;
9
- const { wrapper, AppSchema, store } = await makeTodoMvc();
10
- const { result, rerender } = renderHook((userId) => {
11
- renderCount++;
12
- return LiveStoreReact.useLiveStoreComponent({
13
- stateSchema: AppSchema,
14
- componentKey: { name: 'UserInfo', id: userId },
15
- queries: () => ({}),
16
- });
17
- }, { wrapper, initialProps: 'u1' });
18
- expect(result.current.state.id).toBe('u1');
19
- expect(result.current.state.username).toBe('');
20
- expect(renderCount).toBe(1);
21
- act(() => {
22
- void store.execute(sql `INSERT INTO components__UserInfo (id, username) VALUES ('u2', 'username_u2');`);
23
- });
24
- rerender('u2');
25
- expect(result.current.state.id).toBe('u2');
26
- expect(result.current.state.username).toBe('username_u2');
27
- expect(renderCount).toBe(2);
28
- });
29
- it('should update the data reactively - via setState', async () => {
30
- let renderCount = 0;
31
- const { wrapper, AppSchema } = await makeTodoMvc();
32
- const { result } = renderHook((userId) => {
33
- renderCount++;
34
- return LiveStoreReact.useLiveStoreComponent({
35
- stateSchema: AppSchema,
36
- componentKey: { name: 'UserInfo', id: userId },
37
- queries: () => ({}),
38
- });
39
- }, { wrapper, initialProps: 'u1' });
40
- expect(result.current.state.id).toBe('u1');
41
- expect(result.current.state.username).toBe('');
42
- expect(renderCount).toBe(1);
43
- act(() => result.current.setState.username('username_u1_hello'));
44
- expect(result.current.state.id).toBe('u1');
45
- expect(result.current.state.username).toBe('username_u1_hello');
46
- expect(renderCount).toBe(2);
47
- });
48
- it('should update the data reactively - via raw store update', async () => {
49
- let renderCount = 0;
50
- const { wrapper, AppSchema, store } = await makeTodoMvc();
51
- const { result } = renderHook((userId) => {
52
- renderCount++;
53
- return LiveStoreReact.useLiveStoreComponent({
54
- stateSchema: AppSchema,
55
- componentKey: { name: 'UserInfo', id: userId },
56
- queries: () => ({}),
57
- });
58
- }, { wrapper, initialProps: 'u1' });
59
- expect(result.current.state.id).toBe('u1');
60
- expect(result.current.state.username).toBe('');
61
- expect(renderCount).toBe(1);
62
- act(() => result.current.setState.username('username_u1_hello'));
63
- act(() => {
64
- void store.execute(sql `UPDATE components__UserInfo SET username = 'username_u1_hello' WHERE id = 'u1';`);
65
- });
66
- expect(result.current.state.id).toBe('u1');
67
- expect(result.current.state.username).toBe('username_u1_hello');
68
- expect(renderCount).toBe(2);
69
- });
70
- });
71
- // TODO add a test case that tests the `queries` callback
72
- // TODO add a test case that tests the `subscribe` in the `queries` callback
73
- //# sourceMappingURL=useLiveStoreComponent.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLiveStoreComponent.test.js","sourceRoot":"","sources":["../../../src/__tests__/react/useLiveStoreComponent.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE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,KAAK,KAAK,CAAC,OAAO,CAAC,GAAG,CAAA,iFAAiF,CAAC,CAAA;QAC1G,CAAC,CAAC,CAAA;QAEF,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;QAC/D,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,yDAAyD;AACzD,4EAA4E"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=extractStackInfoFromStackTrace.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractStackInfoFromStackTrace.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/react/utils/extractStackInfoFromStackTrace.test.ts"],"names":[],"mappings":""}
@@ -1,38 +0,0 @@
1
- import { expect, it } from 'vitest';
2
- import { extractStackInfoFromStackTrace } from '../../../react/utils/extractStackInfoFromStackTrace.js';
3
- it('RouteLink stacktrace', async () => {
4
- const stackTrace = `\
5
- Error
6
- at https://localhost:8081/@fs/Users/schickling/Code/overtone/submodules/livestore/packages/@livestore/livestore/dist/react/useQuery.js?t=1699550216884:18:23
7
- at mountMemo (https://localhost:8081/node_modules/.vite-web/deps/chunk-M23HUTQV.js?v=3eb66ed6:12817:27)
8
- at Object.useMemo (https://localhost:8081/node_modules/.vite-web/deps/chunk-M23HUTQV.js?v=3eb66ed6:13141:24)
9
- at Object.useMemo (https://localhost:8081/node_modules/.vite-web/deps/chunk-4WADDZ2G.js?v=3eb66ed6:1094:29)
10
- at useQuery (https://localhost:8081/@fs/Users/schickling/Code/overtone/submodules/livestore/packages/@livestore/livestore/dist/react/useQuery.js?t=1699550216884:13:33)
11
- at useAppState (https://localhost:8081/src/db/AppState.ts?t=1699550216884:17:34)
12
- at useRoute (https://localhost:8081/src/db/AppState.ts?t=1699550216884:74:22)
13
- at RouteLink (https://localhost:8081/src/components/Link.tsx?t=1699550216884:36:7)
14
- at renderWithHooks (https://localhost:8081/node_modules/.vite-web/deps/chunk-M23HUTQV.js?v=3eb66ed6:12171:26)
15
- at mountIndeterminateComponent (https://localhost:8081/node_modules/.vite-web/deps/chunk-M23HUTQV.js?v=3eb66ed6:14921:21)
16
- `;
17
- expect(extractStackInfoFromStackTrace(stackTrace)).toMatchInlineSnapshot(`
18
- [
19
- {
20
- "filePath": "https://localhost:8081/src/components/Link.tsx?t=1699550216884:36:7",
21
- "name": "RouteLink",
22
- },
23
- {
24
- "filePath": "https://localhost:8081/src/db/AppState.ts?t=1699550216884:74:22",
25
- "name": "useRoute",
26
- },
27
- {
28
- "filePath": "https://localhost:8081/src/db/AppState.ts?t=1699550216884:17:34",
29
- "name": "useAppState",
30
- },
31
- {
32
- "filePath": "https://localhost:8081/@fs/Users/schickling/Code/overtone/submodules/livestore/packages/@livestore/livestore/dist/react/useQuery.js?t=1699550216884:13:33",
33
- "name": "useQuery",
34
- },
35
- ]
36
- `);
37
- });
38
- //# sourceMappingURL=extractStackInfoFromStackTrace.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractStackInfoFromStackTrace.test.js","sourceRoot":"","sources":["../../../../src/__tests__/react/utils/extractStackInfoFromStackTrace.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEnC,OAAO,EAAE,8BAA8B,EAAE,MAAM,wDAAwD,CAAA;AAEvG,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;IACpC,MAAM,UAAU,GAAG;;;;;;;;;;;;CAYpB,CAAA;IAEC,MAAM,CAAC,8BAA8B,CAAC,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;GAmBxE,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"bounded-collections.d.ts","sourceRoot":"","sources":["../src/bounded-collections.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,QAAQ,CAAC,CAAC,EAAE,CAAC;;gBAIpB,SAAS,EAAE,MAAM;IAI7B,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAA;IAEvC,GAAG,QAAS,CAAC,SAAS,CAAC,UAUtB;IAED,GAAG,QAAS,CAAC,KAAG,CAAC,GAAG,SAAS,CAE5B;IAED,MAAM,QAAS,CAAC,UAEf;IAED,IAAI,4BAEH;CACF;AAED,qBAAa,QAAQ,CAAC,CAAC;;gBAGT,SAAS,EAAE,MAAM;IAW7B,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAA;IAEvC,GAAG,MAAO,CAAC,UAET;IAEF,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAEhB;CACF;AAED,qBAAa,UAAU,CAAC,CAAC;;gBAIX,SAAS,EAAE,MAAM;IAI7B,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAA;IAEvC,IAAI,MAAO,CAAC,UAQX;IAED,GAAG,UAAW,MAAM,KAAG,CAAC,GAAG,SAAS,CAEnC;IAED,MAAM,UAAW,MAAM,UAEtB;IAED,IAAI,MAAM,WAET;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAEhB;IAED,GAAG,cAAe,CAAC,eAElB;IAED,KAAK,aAEJ;IAED,IAAI,aAAa,CAAC,KAAK,CAAC,KAAK,MAAM,sBAElC;CACF"}
@@ -1,103 +0,0 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _BoundMap_map, _BoundMap_sizeLimit, _BoundSet_map, _BoundSet_onEvict, _a, _BoundArray_array, _BoundArray_sizeLimit, _b;
13
- /**
14
- * Creates a map that has a fixed number of entries.
15
- * Once hitting the bound, earliest insertions are removed
16
- */
17
- class BoundMap {
18
- constructor(sizeLimit) {
19
- _BoundMap_map.set(this, new Map());
20
- _BoundMap_sizeLimit.set(this, void 0);
21
- this.set = (key, value) => {
22
- __classPrivateFieldGet(this, _BoundMap_map, "f").set(key, value);
23
- // console.log(this.#map.size, this.#sizeLimit);
24
- if (__classPrivateFieldGet(this, _BoundMap_map, "f").size > __classPrivateFieldGet(this, _BoundMap_sizeLimit, "f")) {
25
- const firstKey = __classPrivateFieldGet(this, _BoundMap_map, "f").keys().next().value;
26
- __classPrivateFieldGet(this, _BoundMap_map, "f").delete(firstKey);
27
- if (this.onEvict) {
28
- this.onEvict(firstKey);
29
- }
30
- }
31
- };
32
- this.get = (key) => {
33
- return __classPrivateFieldGet(this, _BoundMap_map, "f").get(key);
34
- };
35
- this.delete = (key) => {
36
- __classPrivateFieldGet(this, _BoundMap_map, "f").delete(key);
37
- };
38
- this.keys = () => {
39
- return __classPrivateFieldGet(this, _BoundMap_map, "f").keys();
40
- };
41
- __classPrivateFieldSet(this, _BoundMap_sizeLimit, sizeLimit, "f");
42
- }
43
- }
44
- _BoundMap_map = new WeakMap(), _BoundMap_sizeLimit = new WeakMap();
45
- export default BoundMap;
46
- export class BoundSet {
47
- constructor(sizeLimit) {
48
- _BoundSet_map.set(this, void 0);
49
- _BoundSet_onEvict.set(this, (v) => {
50
- if (this.onEvict) {
51
- this.onEvict(v);
52
- }
53
- });
54
- this.add = (v) => {
55
- __classPrivateFieldGet(this, _BoundSet_map, "f").set(v, v);
56
- };
57
- this[_a] = () => {
58
- return __classPrivateFieldGet(this, _BoundSet_map, "f").keys();
59
- };
60
- __classPrivateFieldSet(this, _BoundSet_map, new BoundMap(sizeLimit), "f");
61
- __classPrivateFieldGet(this, _BoundSet_map, "f").onEvict = __classPrivateFieldGet(this, _BoundSet_onEvict, "f");
62
- }
63
- }
64
- _BoundSet_map = new WeakMap(), _BoundSet_onEvict = new WeakMap(), _a = Symbol.iterator;
65
- export class BoundArray {
66
- constructor(sizeLimit) {
67
- _BoundArray_array.set(this, []);
68
- _BoundArray_sizeLimit.set(this, void 0);
69
- this.push = (v) => {
70
- __classPrivateFieldGet(this, _BoundArray_array, "f").push(v);
71
- if (__classPrivateFieldGet(this, _BoundArray_array, "f").length > __classPrivateFieldGet(this, _BoundArray_sizeLimit, "f")) {
72
- const first = __classPrivateFieldGet(this, _BoundArray_array, "f").shift();
73
- if (first && this.onEvict) {
74
- this.onEvict(first);
75
- }
76
- }
77
- };
78
- this.get = (index) => {
79
- return __classPrivateFieldGet(this, _BoundArray_array, "f")[index];
80
- };
81
- this.delete = (index) => {
82
- __classPrivateFieldGet(this, _BoundArray_array, "f").splice(index, 1);
83
- };
84
- this[_b] = () => {
85
- return __classPrivateFieldGet(this, _BoundArray_array, "f")[Symbol.iterator]();
86
- };
87
- this.map = (fn) => {
88
- return __classPrivateFieldGet(this, _BoundArray_array, "f").map(fn);
89
- };
90
- this.clear = () => {
91
- __classPrivateFieldSet(this, _BoundArray_array, [], "f");
92
- };
93
- this.sort = (fn) => {
94
- return __classPrivateFieldGet(this, _BoundArray_array, "f").sort(fn);
95
- };
96
- __classPrivateFieldSet(this, _BoundArray_sizeLimit, sizeLimit, "f");
97
- }
98
- get length() {
99
- return __classPrivateFieldGet(this, _BoundArray_array, "f").length;
100
- }
101
- }
102
- _BoundArray_array = new WeakMap(), _BoundArray_sizeLimit = new WeakMap(), _b = Symbol.iterator;
103
- //# sourceMappingURL=bounded-collections.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bounded-collections.js","sourceRoot":"","sources":["../src/bounded-collections.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;GAGG;AACH,MAAqB,QAAQ;IAI3B,YAAY,SAAiB;QAH7B,wBAAO,IAAI,GAAG,EAAQ,EAAA;QACtB,sCAAkB;QAQlB,QAAG,GAAG,CAAC,GAAM,EAAE,KAAQ,EAAE,EAAE;YACzB,uBAAA,IAAI,qBAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;YACzB,gDAAgD;YAChD,IAAI,uBAAA,IAAI,qBAAK,CAAC,IAAI,GAAG,uBAAA,IAAI,2BAAW,EAAE;gBACpC,MAAM,QAAQ,GAAG,uBAAA,IAAI,qBAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAA;gBAC9C,uBAAA,IAAI,qBAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;gBAC1B,IAAI,IAAI,CAAC,OAAO,EAAE;oBAChB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;iBACvB;aACF;QACH,CAAC,CAAA;QAED,QAAG,GAAG,CAAC,GAAM,EAAiB,EAAE;YAC9B,OAAO,uBAAA,IAAI,qBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC3B,CAAC,CAAA;QAED,WAAM,GAAG,CAAC,GAAM,EAAE,EAAE;YAClB,uBAAA,IAAI,qBAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACvB,CAAC,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