@lix-js/sdk 0.0.1 → 0.1.0

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 (278) hide show
  1. package/LICENSE +21 -0
  2. package/dist/change/apply-changes.js +9 -9
  3. package/dist/change/apply-changes.js.map +1 -1
  4. package/dist/change/apply-changes.test.js +5 -5
  5. package/dist/change/apply-changes.test.js.map +1 -1
  6. package/dist/database/apply-schema.d.ts.map +1 -1
  7. package/dist/database/apply-schema.js +20 -72
  8. package/dist/database/apply-schema.js.map +1 -1
  9. package/dist/database/execute-sync.test.js +3 -3
  10. package/dist/database/execute-sync.test.js.map +1 -1
  11. package/dist/database/init-db.d.ts.map +1 -1
  12. package/dist/database/init-db.js +18 -3
  13. package/dist/database/init-db.js.map +1 -1
  14. package/dist/database/init-db.test.js +128 -17
  15. package/dist/database/init-db.test.js.map +1 -1
  16. package/dist/database/kysely-plugin/parse-jsonb-plugin-v1.d.ts.map +1 -1
  17. package/dist/database/kysely-plugin/parse-jsonb-plugin-v1.js +5 -2
  18. package/dist/database/kysely-plugin/parse-jsonb-plugin-v1.js.map +1 -1
  19. package/dist/database/mutation-log/database-schema.d.ts.map +1 -1
  20. package/dist/database/mutation-log/database-schema.js +1 -3
  21. package/dist/database/mutation-log/database-schema.js.map +1 -1
  22. package/dist/database/nano-id.d.ts +21 -0
  23. package/dist/database/nano-id.d.ts.map +1 -0
  24. package/dist/database/nano-id.js +58 -0
  25. package/dist/database/nano-id.js.map +1 -0
  26. package/dist/database/nano-id.test.d.ts +2 -0
  27. package/dist/database/nano-id.test.d.ts.map +1 -0
  28. package/dist/database/nano-id.test.js +13 -0
  29. package/dist/database/nano-id.test.js.map +1 -0
  30. package/dist/database/schema.d.ts +15 -23
  31. package/dist/database/schema.d.ts.map +1 -1
  32. package/dist/discussion/create-comment.d.ts +0 -2
  33. package/dist/discussion/create-comment.d.ts.map +1 -1
  34. package/dist/discussion/create-comment.js +0 -1
  35. package/dist/discussion/create-comment.js.map +1 -1
  36. package/dist/discussion/create-discussion.d.ts +3 -5
  37. package/dist/discussion/create-discussion.d.ts.map +1 -1
  38. package/dist/discussion/create-discussion.js +4 -5
  39. package/dist/discussion/create-discussion.js.map +1 -1
  40. package/dist/discussion/create-discussion.test.js +8 -34
  41. package/dist/discussion/create-discussion.test.js.map +1 -1
  42. package/dist/file-queue/file-handlers.d.ts +24 -0
  43. package/dist/file-queue/file-handlers.d.ts.map +1 -0
  44. package/dist/file-queue/file-handlers.js +209 -0
  45. package/dist/file-queue/file-handlers.js.map +1 -0
  46. package/dist/file-queue/file-queue-process.d.ts +5 -0
  47. package/dist/file-queue/file-queue-process.d.ts.map +1 -0
  48. package/dist/file-queue/file-queue-process.js +85 -0
  49. package/dist/file-queue/file-queue-process.js.map +1 -0
  50. package/dist/file-queue/file-queue-process.test.d.ts +2 -0
  51. package/dist/file-queue/file-queue-process.test.d.ts.map +1 -0
  52. package/dist/file-queue/file-queue-process.test.js +373 -0
  53. package/dist/file-queue/file-queue-process.test.js.map +1 -0
  54. package/dist/file-queue/file-queue-settled.d.ts +13 -0
  55. package/dist/file-queue/file-queue-settled.d.ts.map +1 -0
  56. package/dist/file-queue/file-queue-settled.js +25 -0
  57. package/dist/file-queue/file-queue-settled.js.map +1 -0
  58. package/dist/file-queue/file-queue-settled.test.d.ts +2 -0
  59. package/dist/file-queue/file-queue-settled.test.d.ts.map +1 -0
  60. package/dist/file-queue/file-queue-settled.test.js +47 -0
  61. package/dist/file-queue/file-queue-settled.test.js.map +1 -0
  62. package/dist/file-queue/index.d.ts +2 -0
  63. package/dist/file-queue/index.d.ts.map +1 -0
  64. package/dist/file-queue/index.js +2 -0
  65. package/dist/file-queue/index.js.map +1 -0
  66. package/dist/file-queue/with-skip-file-queue.d.ts +3 -0
  67. package/dist/file-queue/with-skip-file-queue.d.ts.map +1 -0
  68. package/dist/file-queue/with-skip-file-queue.js +26 -0
  69. package/dist/file-queue/with-skip-file-queue.js.map +1 -0
  70. package/dist/file-queue/with-skip-file-queue.test.d.ts +2 -0
  71. package/dist/file-queue/with-skip-file-queue.test.d.ts.map +1 -0
  72. package/dist/file-queue/with-skip-file-queue.test.js +138 -0
  73. package/dist/file-queue/with-skip-file-queue.test.js.map +1 -0
  74. package/dist/index.d.ts +2 -2
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +2 -2
  77. package/dist/index.js.map +1 -1
  78. package/dist/key-value/database-schema.d.ts +11 -2
  79. package/dist/key-value/database-schema.d.ts.map +1 -1
  80. package/dist/key-value/database-schema.js +7 -4
  81. package/dist/key-value/database-schema.js.map +1 -1
  82. package/dist/key-value/database-schema.test.js +21 -5
  83. package/dist/key-value/database-schema.test.js.map +1 -1
  84. package/dist/lix/close-lix.d.ts +8 -0
  85. package/dist/lix/close-lix.d.ts.map +1 -0
  86. package/dist/lix/close-lix.js +7 -0
  87. package/dist/lix/close-lix.js.map +1 -0
  88. package/dist/lix/index.d.ts +1 -0
  89. package/dist/lix/index.d.ts.map +1 -1
  90. package/dist/lix/index.js +1 -0
  91. package/dist/lix/index.js.map +1 -1
  92. package/dist/lix/merge.js +3 -3
  93. package/dist/lix/merge.js.map +1 -1
  94. package/dist/lix/merge.test.js +7 -18
  95. package/dist/lix/merge.test.js.map +1 -1
  96. package/dist/lix/new-lix.d.ts.map +1 -1
  97. package/dist/lix/new-lix.js +2 -3
  98. package/dist/lix/new-lix.js.map +1 -1
  99. package/dist/lix/open-lix-in-memory.test.js +2 -1
  100. package/dist/lix/open-lix-in-memory.test.js.map +1 -1
  101. package/dist/lix/open-lix.d.ts +3 -5
  102. package/dist/lix/open-lix.d.ts.map +1 -1
  103. package/dist/lix/open-lix.js +4 -18
  104. package/dist/lix/open-lix.js.map +1 -1
  105. package/dist/lix/open-lix.test.js +16 -7
  106. package/dist/lix/open-lix.test.js.map +1 -1
  107. package/dist/lix/to-blob.d.ts +11 -0
  108. package/dist/lix/to-blob.d.ts.map +1 -0
  109. package/dist/lix/to-blob.js +11 -0
  110. package/dist/lix/to-blob.js.map +1 -0
  111. package/dist/own-change-control/apply-own-change.d.ts +10 -0
  112. package/dist/own-change-control/apply-own-change.d.ts.map +1 -0
  113. package/dist/own-change-control/apply-own-change.js +69 -0
  114. package/dist/own-change-control/apply-own-change.js.map +1 -0
  115. package/dist/own-change-control/apply-own-change.test.d.ts +2 -0
  116. package/dist/own-change-control/apply-own-change.test.d.ts.map +1 -0
  117. package/dist/own-change-control/apply-own-change.test.js +297 -0
  118. package/dist/own-change-control/apply-own-change.test.js.map +1 -0
  119. package/dist/own-change-control/change-controlled-tables.d.ts +60 -0
  120. package/dist/own-change-control/change-controlled-tables.d.ts.map +1 -0
  121. package/dist/own-change-control/change-controlled-tables.js +70 -0
  122. package/dist/own-change-control/change-controlled-tables.js.map +1 -0
  123. package/dist/own-change-control/change-controlled-tables.test.d.ts +2 -0
  124. package/dist/own-change-control/change-controlled-tables.test.d.ts.map +1 -0
  125. package/dist/own-change-control/change-controlled-tables.test.js +48 -0
  126. package/dist/own-change-control/change-controlled-tables.test.js.map +1 -0
  127. package/dist/own-change-control/database-triggers.d.ts +5 -0
  128. package/dist/own-change-control/database-triggers.d.ts.map +1 -0
  129. package/dist/own-change-control/database-triggers.js +135 -0
  130. package/dist/own-change-control/database-triggers.js.map +1 -0
  131. package/dist/own-change-control/database-triggers.test.d.ts +2 -0
  132. package/dist/own-change-control/database-triggers.test.d.ts.map +1 -0
  133. package/dist/own-change-control/database-triggers.test.js +214 -0
  134. package/dist/own-change-control/database-triggers.test.js.map +1 -0
  135. package/dist/own-change-control/index.d.ts +2 -0
  136. package/dist/own-change-control/index.d.ts.map +1 -0
  137. package/dist/own-change-control/index.js +2 -0
  138. package/dist/own-change-control/index.js.map +1 -0
  139. package/dist/own-change-control/with-skip-own-change-control.d.ts +3 -0
  140. package/dist/own-change-control/with-skip-own-change-control.d.ts.map +1 -0
  141. package/dist/own-change-control/with-skip-own-change-control.js +28 -0
  142. package/dist/own-change-control/with-skip-own-change-control.js.map +1 -0
  143. package/dist/own-change-control/with-skip-own-change-control.test.d.ts +2 -0
  144. package/dist/own-change-control/with-skip-own-change-control.test.d.ts.map +1 -0
  145. package/dist/own-change-control/with-skip-own-change-control.test.js +49 -0
  146. package/dist/own-change-control/with-skip-own-change-control.test.js.map +1 -0
  147. package/dist/own-entity-change-control/apply-own-entity-change.js +2 -2
  148. package/dist/own-entity-change-control/apply-own-entity-change.js.map +1 -1
  149. package/dist/own-entity-change-control/apply-own-entity-change.test.js +9 -9
  150. package/dist/own-entity-change-control/apply-own-entity-change.test.js.map +1 -1
  151. package/dist/own-entity-change-control/database-triggers.js +6 -6
  152. package/dist/own-entity-change-control/database-triggers.js.map +1 -1
  153. package/dist/own-entity-change-control/database-triggers.test.js +1 -1
  154. package/dist/own-entity-change-control/database-triggers.test.js.map +1 -1
  155. package/dist/query-filter/version-change-in-difference.test.js +37 -29
  156. package/dist/query-filter/version-change-in-difference.test.js.map +1 -1
  157. package/dist/query-filter/version-change-in-symmetric-difference.test.js +37 -39
  158. package/dist/query-filter/version-change-in-symmetric-difference.test.js.map +1 -1
  159. package/dist/server-api-handler/environment/create-in-memory-environment.d.ts.map +1 -1
  160. package/dist/server-api-handler/environment/create-in-memory-environment.js +7 -3
  161. package/dist/server-api-handler/environment/create-in-memory-environment.js.map +1 -1
  162. package/dist/server-api-handler/environment/create-in-memory-environment.test.js +8 -7
  163. package/dist/server-api-handler/environment/create-in-memory-environment.test.js.map +1 -1
  164. package/dist/server-api-handler/routes/get-v1.d.ts.map +1 -1
  165. package/dist/server-api-handler/routes/get-v1.js +1 -2
  166. package/dist/server-api-handler/routes/get-v1.js.map +1 -1
  167. package/dist/server-api-handler/routes/get-v1.test.js +6 -5
  168. package/dist/server-api-handler/routes/get-v1.test.js.map +1 -1
  169. package/dist/server-api-handler/routes/new-v1.d.ts.map +1 -1
  170. package/dist/server-api-handler/routes/new-v1.js +3 -1
  171. package/dist/server-api-handler/routes/new-v1.js.map +1 -1
  172. package/dist/server-api-handler/routes/new-v1.test.js +2 -1
  173. package/dist/server-api-handler/routes/new-v1.test.js.map +1 -1
  174. package/dist/server-api-handler/routes/pull-v1.test.js +4 -3
  175. package/dist/server-api-handler/routes/pull-v1.test.js.map +1 -1
  176. package/dist/server-api-handler/routes/push-v1.test.js +5 -4
  177. package/dist/server-api-handler/routes/push-v1.test.js.map +1 -1
  178. package/dist/sync/pull-from-server.d.ts.map +1 -1
  179. package/dist/sync/pull-from-server.js +0 -2
  180. package/dist/sync/pull-from-server.js.map +1 -1
  181. package/dist/sync/pull-from-server.test.js +29 -14
  182. package/dist/sync/pull-from-server.test.js.map +1 -1
  183. package/dist/sync/push-to-server.test.js +17 -13
  184. package/dist/sync/push-to-server.test.js.map +1 -1
  185. package/dist/sync/sync-process.d.ts +2 -4
  186. package/dist/sync/sync-process.d.ts.map +1 -1
  187. package/dist/sync/sync-process.js +4 -9
  188. package/dist/sync/sync-process.js.map +1 -1
  189. package/dist/sync/sync-process.test.js +26 -38
  190. package/dist/sync/sync-process.test.js.map +1 -1
  191. package/dist/version/create-version.d.ts +5 -5
  192. package/dist/version/create-version.d.ts.map +1 -1
  193. package/dist/version/create-version.js +23 -11
  194. package/dist/version/create-version.js.map +1 -1
  195. package/dist/version/create-version.test.js +2 -2
  196. package/dist/version/create-version.test.js.map +1 -1
  197. package/dist/version/merge-version.d.ts.map +1 -1
  198. package/dist/version/merge-version.js +16 -26
  199. package/dist/version/merge-version.js.map +1 -1
  200. package/dist/version/switch-version.js +3 -3
  201. package/dist/version/switch-version.js.map +1 -1
  202. package/dist/version/switch-version.test.js +12 -15
  203. package/dist/version/switch-version.test.js.map +1 -1
  204. package/dist/version/update-changes-in-version.d.ts.map +1 -1
  205. package/dist/version/update-changes-in-version.js +11 -31
  206. package/dist/version/update-changes-in-version.js.map +1 -1
  207. package/node_modules/@lix-js/server-api-schema/CHANGELOG.md +9 -0
  208. package/node_modules/@lix-js/server-api-schema/LICENSE +21 -0
  209. package/node_modules/@lix-js/server-api-schema/dist/schema.js +0 -0
  210. package/node_modules/@lix-js/server-api-schema/package.json +2 -2
  211. package/node_modules/sqlite-wasm-kysely/LICENSE +21 -0
  212. package/package.json +4 -4
  213. package/src/change/apply-changes.test.ts +7 -7
  214. package/src/change/apply-changes.ts +9 -9
  215. package/src/database/apply-schema.ts +20 -73
  216. package/src/database/execute-sync.test.ts +3 -3
  217. package/src/database/init-db.test.ts +163 -19
  218. package/src/database/init-db.ts +20 -3
  219. package/src/database/kysely-plugin/parse-jsonb-plugin-v1.ts +9 -2
  220. package/src/database/mutation-log/database-schema.ts +1 -3
  221. package/src/database/nano-id.test.ts +15 -0
  222. package/src/database/nano-id.ts +72 -0
  223. package/src/database/schema.ts +15 -24
  224. package/src/discussion/create-comment.ts +0 -3
  225. package/src/discussion/create-discussion.test.ts +8 -39
  226. package/src/discussion/create-discussion.ts +6 -9
  227. package/src/{change-queue → file-queue}/file-handlers.ts +27 -27
  228. package/src/{change-queue/init-change-queue.test.ts → file-queue/file-queue-process.test.ts} +24 -24
  229. package/src/{change-queue/init-change-queue.ts → file-queue/file-queue-process.ts} +18 -16
  230. package/src/{change-queue/change-queue-settled.test.ts → file-queue/file-queue-settled.test.ts} +12 -12
  231. package/src/{change-queue/change-queue-settled.ts → file-queue/file-queue-settled.ts} +4 -4
  232. package/src/file-queue/index.ts +1 -0
  233. package/src/{change-queue/with-skip-change-queue.test.ts → file-queue/with-skip-file-queue.test.ts} +9 -9
  234. package/src/{change-queue/with-skip-change-queue.ts → file-queue/with-skip-file-queue.ts} +3 -3
  235. package/src/index.ts +2 -2
  236. package/src/key-value/database-schema.test.ts +26 -5
  237. package/src/key-value/database-schema.ts +18 -6
  238. package/src/lix/close-lix.ts +8 -0
  239. package/src/lix/index.ts +1 -0
  240. package/src/lix/merge.test.ts +7 -19
  241. package/src/lix/merge.ts +4 -4
  242. package/src/lix/new-lix.ts +2 -3
  243. package/src/lix/open-lix-in-memory.test.ts +5 -1
  244. package/src/lix/open-lix.test.ts +19 -7
  245. package/src/lix/open-lix.ts +7 -24
  246. package/src/lix/to-blob.ts +14 -0
  247. package/src/{own-entity-change-control/apply-own-entity-change.test.ts → own-change-control/apply-own-change.test.ts} +27 -31
  248. package/src/{own-entity-change-control/apply-own-entity-change.ts → own-change-control/apply-own-change.ts} +3 -3
  249. package/src/{own-entity-change-control → own-change-control}/change-controlled-tables.ts +0 -1
  250. package/src/{own-entity-change-control → own-change-control}/database-triggers.test.ts +7 -7
  251. package/src/{own-entity-change-control → own-change-control}/database-triggers.ts +11 -11
  252. package/src/{own-entity-change-control → own-change-control}/with-skip-own-change-control.ts +6 -2
  253. package/src/query-filter/version-change-in-difference.test.ts +41 -32
  254. package/src/query-filter/version-change-in-symmetric-difference.test.ts +41 -42
  255. package/src/server-api-handler/environment/create-in-memory-environment.test.ts +8 -7
  256. package/src/server-api-handler/environment/create-in-memory-environment.ts +7 -3
  257. package/src/server-api-handler/routes/get-v1.test.ts +6 -5
  258. package/src/server-api-handler/routes/get-v1.ts +1 -3
  259. package/src/server-api-handler/routes/new-v1.test.ts +2 -1
  260. package/src/server-api-handler/routes/new-v1.ts +3 -1
  261. package/src/server-api-handler/routes/pull-v1.test.ts +4 -3
  262. package/src/server-api-handler/routes/push-v1.test.ts +5 -4
  263. package/src/sync/pull-from-server.test.ts +29 -14
  264. package/src/sync/pull-from-server.ts +0 -2
  265. package/src/sync/push-to-server.test.ts +19 -15
  266. package/src/sync/sync-process.test.ts +37 -43
  267. package/src/sync/sync-process.ts +6 -18
  268. package/src/version/create-version.test.ts +2 -2
  269. package/src/version/create-version.ts +24 -12
  270. package/src/version/merge-version.ts +18 -26
  271. package/src/version/switch-version.test.ts +12 -15
  272. package/src/version/switch-version.ts +3 -3
  273. package/src/version/update-changes-in-version.ts +11 -30
  274. package/node_modules/@lix-js/server-api-schema/dist/schema.d.ts +0 -384
  275. package/src/change-queue/index.ts +0 -1
  276. /package/src/{own-entity-change-control → own-change-control}/change-controlled-tables.test.ts +0 -0
  277. /package/src/{own-entity-change-control → own-change-control}/index.ts +0 -0
  278. /package/src/{own-entity-change-control → own-change-control}/with-skip-own-change-control.test.ts +0 -0
@@ -5,9 +5,9 @@ import type {
5
5
  ChangeSet,
6
6
  ChangeSetElement,
7
7
  } from "../database/schema.js";
8
- import { applyOwnEntityChanges } from "./apply-own-entity-change.js";
8
+ import { applyOwnChanges } from "./apply-own-change.js";
9
9
  import { mockJsonSnapshot } from "../snapshot/mock-json-snapshot.js";
10
- import { type KeyValue } from "../key-value/database-schema.js";
10
+ import { type NewKeyValue } from "../key-value/database-schema.js";
11
11
 
12
12
  test("it should apply insert changes correctly", async () => {
13
13
  const lix = await openLixInMemory({});
@@ -21,8 +21,8 @@ test("it should apply insert changes correctly", async () => {
21
21
  id: "change1",
22
22
  entity_id: "key1",
23
23
  schema_key: "lix_key_value_table",
24
- plugin_key: "lix_own_entity",
25
- file_id: "null",
24
+ plugin_key: "lix_own_change_control",
25
+ file_id: "lix_own_change_control",
26
26
  snapshot_id: snapshot.id,
27
27
  created_at: "2021-01-01T00:00:00.000Z",
28
28
  };
@@ -32,7 +32,7 @@ test("it should apply insert changes correctly", async () => {
32
32
  .values({ content: snapshot.content })
33
33
  .execute();
34
34
 
35
- await applyOwnEntityChanges({ lix, changes: [change] });
35
+ await applyOwnChanges({ lix, changes: [change] });
36
36
 
37
37
  const result = await lix.db
38
38
  .selectFrom("key_value")
@@ -40,7 +40,7 @@ test("it should apply insert changes correctly", async () => {
40
40
  .selectAll()
41
41
  .executeTakeFirst();
42
42
 
43
- expect(result).toEqual({ key: "key1", value: "value1" });
43
+ expect(result).toMatchObject({ key: "key1", value: "value1" });
44
44
  });
45
45
 
46
46
  test("it should apply update changes correctly", async () => {
@@ -60,9 +60,9 @@ test("it should apply update changes correctly", async () => {
60
60
  id: "change1",
61
61
  schema_key: "lix_key_value_table",
62
62
  entity_id: "key1",
63
- file_id: "null",
63
+ file_id: "lix_own_change_control",
64
64
  created_at: "2021-01-01T00:00:00.000Z",
65
- plugin_key: "lix_own_entity",
65
+ plugin_key: "lix_own_change_control",
66
66
  snapshot_id: snapshot.id,
67
67
  };
68
68
 
@@ -73,7 +73,7 @@ test("it should apply update changes correctly", async () => {
73
73
  })
74
74
  .execute();
75
75
 
76
- await applyOwnEntityChanges({ lix, changes: [change] });
76
+ await applyOwnChanges({ lix, changes: [change] });
77
77
 
78
78
  const result = await lix.db
79
79
  .selectFrom("key_value")
@@ -81,7 +81,7 @@ test("it should apply update changes correctly", async () => {
81
81
  .selectAll()
82
82
  .executeTakeFirst();
83
83
 
84
- expect(result).toEqual({ key: "key1", value: "new_value" });
84
+ expect(result).toMatchObject({ key: "key1", value: "new_value" });
85
85
  });
86
86
 
87
87
  test("it should apply delete changes correctly", async () => {
@@ -95,14 +95,14 @@ test("it should apply delete changes correctly", async () => {
95
95
  const change: Change = {
96
96
  id: "change1",
97
97
  schema_key: "lix_key_value_table",
98
- file_id: "null",
98
+ file_id: "lix_own_change_control",
99
99
  created_at: "2021-01-01T00:00:00.000Z",
100
100
  entity_id: "key1",
101
- plugin_key: "lix_own_entity",
101
+ plugin_key: "lix_own_change_control",
102
102
  snapshot_id: "no-content",
103
103
  };
104
104
 
105
- await applyOwnEntityChanges({ lix, changes: [change] });
105
+ await applyOwnChanges({ lix, changes: [change] });
106
106
 
107
107
  const result = await lix.db
108
108
  .selectFrom("key_value")
@@ -120,7 +120,7 @@ test("it should throw an error for invalid plugin key", async () => {
120
120
  id: "change1",
121
121
  schema_key: "lix_key_value_table",
122
122
  entity_id: "key1",
123
- file_id: "null",
123
+ file_id: "lix_own_change_control",
124
124
  created_at: "2021-01-01T00:00:00.000Z",
125
125
  plugin_key: "invalid-plugin",
126
126
  snapshot_id: "snapshot1",
@@ -138,10 +138,8 @@ test("it should throw an error for invalid plugin key", async () => {
138
138
  })
139
139
  .execute();
140
140
 
141
- await expect(
142
- applyOwnEntityChanges({ lix, changes: [change] })
143
- ).rejects.toThrow(
144
- "Expected 'lix_own_entity' as plugin key but received invalid-plugin"
141
+ await expect(applyOwnChanges({ lix, changes: [change] })).rejects.toThrow(
142
+ "Expected 'lix_own_change_control' as plugin key but received invalid-plugin"
145
143
  );
146
144
  });
147
145
 
@@ -189,13 +187,13 @@ test("file.data is not changed by applyOwnEntityChanges", async () => {
189
187
  id: "change1",
190
188
  entity_id: file.id,
191
189
  schema_key: "lix_file_table",
192
- plugin_key: "lix_own_entity",
190
+ plugin_key: "lix_own_change_control",
193
191
  file_id: "null",
194
192
  snapshot_id: snapshot.id,
195
193
  created_at: "2021-01-01T00:00:00.000Z",
196
194
  };
197
195
 
198
- await applyOwnEntityChanges({ lix, changes: [mockChange] });
196
+ await applyOwnChanges({ lix, changes: [mockChange] });
199
197
 
200
198
  const result = await lix.db
201
199
  .selectFrom("file")
@@ -230,7 +228,7 @@ test("foreign key constraints are deferred to make the order of applying changes
230
228
  id: "change2",
231
229
  entity_id: "change-set-1,change0",
232
230
  schema_key: "lix_change_set_element_table",
233
- plugin_key: "lix_own_entity",
231
+ plugin_key: "lix_own_change_control",
234
232
  file_id: "null",
235
233
  snapshot_id: snapshots[1].id,
236
234
  created_at: "2021-01-01T00:00:00.000Z",
@@ -239,7 +237,7 @@ test("foreign key constraints are deferred to make the order of applying changes
239
237
  id: "change1",
240
238
  entity_id: "change-set-1",
241
239
  schema_key: "lix_change_set_table",
242
- plugin_key: "lix_own_entity",
240
+ plugin_key: "lix_own_change_control",
243
241
  file_id: "null",
244
242
  snapshot_id: snapshots[0].id,
245
243
  created_at: "2021-01-01T00:00:00.000Z",
@@ -270,7 +268,7 @@ test("foreign key constraints are deferred to make the order of applying changes
270
268
  .execute();
271
269
 
272
270
  await expect(
273
- applyOwnEntityChanges({ lix, changes: mockChanges })
271
+ applyOwnChanges({ lix, changes: mockChanges })
274
272
  ).resolves.toBeUndefined();
275
273
  });
276
274
 
@@ -291,8 +289,8 @@ test("foreign key constraints are obeyed", async () => {
291
289
  // the change set for this change does not exist
292
290
  entity_id: "change-set-1,change0",
293
291
  schema_key: "lix_change_set_element_table",
294
- plugin_key: "lix_own_entity",
295
- file_id: "null",
292
+ plugin_key: "lix_own_change_control",
293
+ file_id: "lix_own_change_control",
296
294
  snapshot_id: snapshots[0].id,
297
295
  created_at: "2021-01-01T00:00:00.000Z",
298
296
  },
@@ -321,9 +319,7 @@ test("foreign key constraints are obeyed", async () => {
321
319
  })
322
320
  .execute();
323
321
 
324
- expect(
325
- applyOwnEntityChanges({ lix, changes: mockChanges })
326
- ).rejects.toThrow();
322
+ expect(applyOwnChanges({ lix, changes: mockChanges })).rejects.toThrow();
327
323
  });
328
324
 
329
325
  // https://github.com/opral/lix-sdk/issues/185
@@ -333,7 +329,7 @@ test("applying own entity changes doesn't lead to the creation of new changes",
333
329
  const snapshot = mockJsonSnapshot({
334
330
  key: "mock-key",
335
331
  value: "1+1=2",
336
- } satisfies KeyValue);
332
+ } satisfies NewKeyValue);
337
333
 
338
334
  await lix.db
339
335
  .insertInto("snapshot")
@@ -344,14 +340,14 @@ test("applying own entity changes doesn't lead to the creation of new changes",
344
340
 
345
341
  const changesBefore = await lix.db.selectFrom("change").selectAll().execute();
346
342
 
347
- await applyOwnEntityChanges({
343
+ await applyOwnChanges({
348
344
  lix,
349
345
  changes: [
350
346
  {
351
347
  id: "change0",
352
348
  entity_id: "mock-key",
353
349
  file_id: "null",
354
- plugin_key: "lix_own_entity",
350
+ plugin_key: "lix_own_change_control",
355
351
  schema_key: "lix_key_value_table",
356
352
  snapshot_id: snapshot.id,
357
353
  created_at: "2021-01-01T00:00:00Z",
@@ -16,7 +16,7 @@ import { withSkipOwnChangeControl } from "./with-skip-own-change-control.js";
16
16
  /**
17
17
  * Applies own changes to lix itself.
18
18
  */
19
- export async function applyOwnEntityChanges(args: {
19
+ export async function applyOwnChanges(args: {
20
20
  lix: Pick<Lix, "db">;
21
21
  changes: Change[];
22
22
  }): Promise<void> {
@@ -31,9 +31,9 @@ export async function applyOwnEntityChanges(args: {
31
31
 
32
32
  await Promise.all(
33
33
  args.changes.map(async (change) => {
34
- if (change.plugin_key !== "lix_own_entity") {
34
+ if (change.plugin_key !== "lix_own_change_control") {
35
35
  throw new Error(
36
- "Expected 'lix_own_entity' as plugin key but received " +
36
+ "Expected 'lix_own_change_control' as plugin key but received " +
37
37
  change.plugin_key
38
38
  );
39
39
  }
@@ -5,7 +5,6 @@ export const changeControlledTableIds = {
5
5
  change_author: ["change_id", "account_id"],
6
6
  change_set_element: ["change_set_id", "change_id"],
7
7
  change_set_label: ["label_id", "change_set_id"],
8
- change_set_label_author: ["label_id", "change_set_id", "account_id"],
9
8
  discussion: ["id"],
10
9
  file: ["id"],
11
10
  key_value: ["key"],
@@ -35,12 +35,12 @@ test("it works for inserts, updates and deletions", async () => {
35
35
 
36
36
  for (const change of changes) {
37
37
  expect(change.entity_id).toBe("key1");
38
- expect(change.file_id).toBe("null");
39
- expect(change.plugin_key).toBe("lix_own_entity");
38
+ expect(change.file_id).toBe("lix_own_change_control");
39
+ expect(change.plugin_key).toBe("lix_own_change_control");
40
40
  expect(change.schema_key).toBe("lix_key_value_table");
41
41
  }
42
42
 
43
- expect(snapshots).toStrictEqual([
43
+ expect(snapshots).toMatchObject([
44
44
  // insert
45
45
  { key: "key1", value: "value1" },
46
46
  // update
@@ -125,23 +125,23 @@ test("if the trigger throws, the transaction is rolled back", async () => {
125
125
  expect(deleteChange).toBeUndefined();
126
126
  });
127
127
 
128
- test("skips change control of key values if the key begins with `#`", async () => {
128
+ test("skips change control of key values if `skip_change_control` is set to true", async () => {
129
129
  const lix = await openLixInMemory({});
130
130
 
131
131
  await lix.db
132
132
  .insertInto("key_value")
133
- .values({ key: "#key1", value: "value1" })
133
+ .values({ key: "key1", value: "value1", skip_change_control: true })
134
134
  .execute();
135
135
 
136
136
  const key1 = await lix.db
137
137
  .selectFrom("key_value")
138
- .where("key", "=", "#key1")
138
+ .where("key", "=", "key1")
139
139
  .selectAll()
140
140
  .executeTakeFirst();
141
141
 
142
142
  const key1Change = await lix.db
143
143
  .selectFrom("change")
144
- .where("entity_id", "=", "#key1")
144
+ .where("entity_id", "=", "key1")
145
145
  .selectAll()
146
146
  .executeTakeFirst();
147
147
 
@@ -9,7 +9,7 @@ import {
9
9
  import { createChange } from "../change/create-change.js";
10
10
  import { executeSync } from "../database/execute-sync.js";
11
11
 
12
- export function applyOwnEntityChangeControlTriggers(
12
+ export function applyOwnChangeControlTriggers(
13
13
  sqlite: SqliteDatabase,
14
14
  db: Kysely<LixDatabaseSchema>
15
15
  ): void {
@@ -24,7 +24,7 @@ export function applyOwnEntityChangeControlTriggers(
24
24
  }
25
25
 
26
26
  sqlite.createFunction({
27
- name: "handle_lix_own_entity_change",
27
+ name: "handle_lix_own_change_control",
28
28
  arity: -1,
29
29
  // @ts-expect-error - dynamic function
30
30
  xFunc: (
@@ -51,7 +51,7 @@ export function applyOwnEntityChangeControlTriggers(
51
51
  CREATE TEMP TRIGGER IF NOT EXISTS ${table}_change_control_insert
52
52
  AFTER INSERT ON ${table}
53
53
  BEGIN
54
- SELECT handle_lix_own_entity_change('${table}', 'insert', ${tableInfo.map((c) => "NEW." + c.name).join(", ")});
54
+ SELECT handle_lix_own_change_control('${table}', 'insert', ${tableInfo.map((c) => "NEW." + c.name).join(", ")});
55
55
  END;
56
56
 
57
57
  CREATE TEMP TRIGGER IF NOT EXISTS ${table}_change_control_update
@@ -69,13 +69,13 @@ export function applyOwnEntityChangeControlTriggers(
69
69
  : ""
70
70
  }
71
71
  BEGIN
72
- SELECT handle_lix_own_entity_change('${table}', 'update', ${tableInfo.map((c) => "NEW." + c.name).join(", ")});
72
+ SELECT handle_lix_own_change_control('${table}', 'update', ${tableInfo.map((c) => "NEW." + c.name).join(", ")});
73
73
  END;
74
74
 
75
75
  CREATE TEMP TRIGGER IF NOT EXISTS ${table}_change_control_delete
76
76
  AFTER DELETE ON ${table}
77
77
  BEGIN
78
- SELECT handle_lix_own_entity_change('${table}', 'delete', ${tableInfo.map((c) => "OLD." + c.name).join(", ")});
78
+ SELECT handle_lix_own_change_control('${table}', 'delete', ${tableInfo.map((c) => "OLD." + c.name).join(", ")});
79
79
  END;
80
80
  `;
81
81
 
@@ -93,8 +93,8 @@ function handleLixOwnEntityChange(
93
93
  ): void {
94
94
  const lix = { db, sqlite };
95
95
 
96
- // keys starting with `#` are not change controlled
97
- if (tableName === "key_value" && values[0].startsWith("#")) {
96
+ // key values that have skip_change_control set to true should not be change controlled
97
+ if (tableName === "key_value" && values[2]) {
98
98
  return;
99
99
  }
100
100
 
@@ -103,7 +103,7 @@ function handleLixOwnEntityChange(
103
103
  lix,
104
104
  query: db
105
105
  .selectFrom("key_value")
106
- .where("key", "=", "#lix_skip_own_change_control")
106
+ .where("key", "=", "lix_skip_own_change_control")
107
107
  .select("value"),
108
108
  })[0]?.value === "true";
109
109
 
@@ -120,7 +120,7 @@ function handleLixOwnEntityChange(
120
120
  .select("plugin_key"),
121
121
  })[0];
122
122
 
123
- if (change?.plugin_key === "lix_own_entity") {
123
+ if (change?.plugin_key === "lix_own_change_control") {
124
124
  return;
125
125
  }
126
126
 
@@ -177,8 +177,8 @@ function handleLixOwnEntityChange(
177
177
  authors: authors,
178
178
  version: currentVersion,
179
179
  entityId,
180
- fileId: "null",
181
- pluginKey: "lix_own_entity",
180
+ fileId: "lix_own_change_control",
181
+ pluginKey: "lix_own_change_control",
182
182
  schemaKey: `lix_${tableName}_table`,
183
183
  snapshotContent,
184
184
  },
@@ -7,7 +7,11 @@ export async function withSkipOwnChangeControl<T>(
7
7
  const executeInTransaction = async (trx: Lix["db"]) => {
8
8
  await trx
9
9
  .insertInto("key_value")
10
- .values({ key: "#lix_skip_own_change_control", value: "true" })
10
+ .values({
11
+ key: "lix_skip_own_change_control",
12
+ value: "true",
13
+ skip_change_control: true,
14
+ })
11
15
  .onConflict((oc) => oc.doUpdateSet({ value: "true" }))
12
16
  .execute();
13
17
 
@@ -16,7 +20,7 @@ export async function withSkipOwnChangeControl<T>(
16
20
 
17
21
  await trx
18
22
  .deleteFrom("key_value")
19
- .where("key", "=", "#lix_skip_own_change_control")
23
+ .where("key", "=", "lix_skip_own_change_control")
20
24
  .execute();
21
25
 
22
26
  // Return the result of the operation
@@ -4,6 +4,7 @@ import type { VersionChange } from "../database/schema.js";
4
4
  import { mockChange } from "../change/mock-change.js";
5
5
  import { createVersion } from "../version/create-version.js";
6
6
  import { versionChangeInDifference } from "./version-change-in-difference.js";
7
+ import { updateChangesInVersion } from "../version/update-changes-in-version.js";
7
8
 
8
9
  test("should return the difference between two versions", async () => {
9
10
  const lix = await openLixInMemory({});
@@ -11,42 +12,42 @@ test("should return the difference between two versions", async () => {
11
12
  const versionA = await createVersion({ lix });
12
13
  const versionB = await createVersion({ lix });
13
14
 
15
+ const mockChanges = [
16
+ mockChange({ id: "change0", entity_id: "entity0" }),
17
+ mockChange({ id: "change1", entity_id: "entity1" }),
18
+ mockChange({ id: "change2", entity_id: "entity2" }),
19
+ mockChange({ id: "change3", entity_id: "entity3" }),
20
+ ] as const;
21
+
14
22
  await lix.db
15
23
  .insertInto("change")
16
- .values([
17
- mockChange({ id: "change1" }),
18
- mockChange({ id: "change2" }),
19
- mockChange({ id: "change3" }),
20
- mockChange({ id: "change4" }),
21
- ])
24
+ .values(mockChanges)
22
25
  .returningAll()
23
26
  .execute();
24
27
 
25
- const changesA: VersionChange[] = [
26
- { version_id: versionA.id, change_id: "change1" },
27
- { version_id: versionA.id, change_id: "change2" },
28
- ];
29
-
30
- const changesB: VersionChange[] = [
31
- { version_id: versionB.id, change_id: "change2" },
32
- { version_id: versionB.id, change_id: "change3" },
33
- ];
28
+ await updateChangesInVersion({
29
+ lix,
30
+ version: versionA,
31
+ changes: [mockChanges[0], mockChanges[1]],
32
+ });
34
33
 
35
- await lix.db
36
- .insertInto("version_change")
37
- .values([...changesA, ...changesB])
38
- .execute();
34
+ await updateChangesInVersion({
35
+ lix,
36
+ version: versionB,
37
+ changes: [mockChanges[1], mockChanges[2]],
38
+ });
39
39
 
40
40
  const result = await lix.db
41
41
  .selectFrom("version_change")
42
42
  .where(versionChangeInDifference(versionA, versionB))
43
- .selectAll()
43
+ .select("version_id")
44
+ .select("change_id")
44
45
  .execute();
45
46
 
46
47
  expect(result).toEqual([
47
- // change1 is in A but not in B
48
- { version_id: versionA.id, change_id: "change1" },
49
- ] satisfies VersionChange[]);
48
+ // change0 is in A but not in B
49
+ expect.objectContaining({ version_id: versionA.id, change_id: "change0" }),
50
+ ] satisfies Partial<VersionChange>[]);
50
51
  });
51
52
 
52
53
  test("should return an empty array if there are no differences", async () => {
@@ -55,20 +56,28 @@ test("should return an empty array if there are no differences", async () => {
55
56
  const versionA = await createVersion({ lix });
56
57
  const versionB = await createVersion({ lix });
57
58
 
59
+ const mockChanges = [
60
+ mockChange({ id: "change0" }),
61
+ mockChange({ id: "change1" }),
62
+ ];
63
+
58
64
  await lix.db
59
65
  .insertInto("change")
60
- .values([mockChange({ id: "change1" }), mockChange({ id: "change2" })])
66
+ .values(mockChanges)
61
67
  .returningAll()
62
68
  .execute();
63
69
 
64
- const changes: VersionChange[] = [
65
- { version_id: versionA.id, change_id: "change1" },
66
- { version_id: versionA.id, change_id: "change2" },
67
- { version_id: versionB.id, change_id: "change1" },
68
- { version_id: versionB.id, change_id: "change2" },
69
- ];
70
-
71
- await lix.db.insertInto("version_change").values(changes).execute();
70
+ await updateChangesInVersion({
71
+ lix,
72
+ version: versionA,
73
+ changes: mockChanges,
74
+ });
75
+
76
+ await updateChangesInVersion({
77
+ lix,
78
+ version: versionB,
79
+ changes: mockChanges,
80
+ });
72
81
 
73
82
  const result = await lix.db
74
83
  .selectFrom("version_change")
@@ -4,6 +4,7 @@ import type { VersionChange } from "../database/schema.js";
4
4
  import { mockChange } from "../change/mock-change.js";
5
5
  import { createVersion } from "../version/create-version.js";
6
6
  import { versionChangeInSymmetricDifference } from "./version-change-in-symmetric-difference.js";
7
+ import { updateChangesInVersion } from "../version/update-changes-in-version.js";
7
8
 
8
9
  test("should return the symmetric difference between two versions", async () => {
9
10
  const lix = await openLixInMemory({});
@@ -11,31 +12,26 @@ test("should return the symmetric difference between two versions", async () =>
11
12
  const versionA = await createVersion({ lix });
12
13
  const versionB = await createVersion({ lix });
13
14
 
14
- await lix.db
15
- .insertInto("change")
16
- .values([
17
- mockChange({ id: "change1" }),
18
- mockChange({ id: "change2" }),
19
- mockChange({ id: "change3" }),
20
- mockChange({ id: "change4" }),
21
- ])
22
- .returningAll()
23
- .execute();
15
+ const mockChanges = [
16
+ mockChange({ id: "change0", entity_id: "entity0" }),
17
+ mockChange({ id: "change1", entity_id: "entity1" }),
18
+ mockChange({ id: "change2", entity_id: "entity2" }),
19
+ mockChange({ id: "change3", entity_id: "entity3" }),
20
+ ] as const;
24
21
 
25
- const changesA: VersionChange[] = [
26
- { version_id: versionA.id, change_id: "change1" },
27
- { version_id: versionA.id, change_id: "change2" },
28
- ];
22
+ await lix.db.insertInto("change").values(mockChanges).execute();
29
23
 
30
- const changesB: VersionChange[] = [
31
- { version_id: versionB.id, change_id: "change2" },
32
- { version_id: versionB.id, change_id: "change3" },
33
- ];
24
+ await updateChangesInVersion({
25
+ lix,
26
+ version: versionA,
27
+ changes: [mockChanges[0], mockChanges[1]],
28
+ });
34
29
 
35
- await lix.db
36
- .insertInto("version_change")
37
- .values([...changesA, ...changesB])
38
- .execute();
30
+ await updateChangesInVersion({
31
+ lix,
32
+ version: versionB,
33
+ changes: [mockChanges[1], mockChanges[2]],
34
+ });
39
35
 
40
36
  const result = await lix.db
41
37
  .selectFrom("version_change")
@@ -44,13 +40,13 @@ test("should return the symmetric difference between two versions", async () =>
44
40
  .execute();
45
41
 
46
42
  expect(result).toEqual([
47
- // change 1 is in A but not in B
48
- { version_id: versionA.id, change_id: "change1" },
49
- // change 3 is in B but not in A
50
- { version_id: versionB.id, change_id: "change3" },
51
- // change 4 is in neither A nor B
43
+ // change 0 is in A but not in B
44
+ expect.objectContaining({ version_id: versionA.id, change_id: "change0" }),
45
+ // change 2 is in B but not in A
46
+ expect.objectContaining({ version_id: versionB.id, change_id: "change2" }),
47
+ // change 3 is in neither A nor B
52
48
  // hence not in the symmetric difference
53
- ] satisfies VersionChange[]);
49
+ ] satisfies Partial<VersionChange>[]);
54
50
  });
55
51
 
56
52
  test("should return an empty array if there are no differences", async () => {
@@ -59,25 +55,28 @@ test("should return an empty array if there are no differences", async () => {
59
55
  const versionA = await createVersion({ lix });
60
56
  const versionB = await createVersion({ lix });
61
57
 
58
+ const mockChanges = [
59
+ mockChange({ id: "change0", entity_id: "entity0" }),
60
+ mockChange({ id: "change1", entity_id: "entity1" }),
61
+ ] as const;
62
+
62
63
  await lix.db
63
64
  .insertInto("change")
64
- .values([
65
- mockChange({ id: "change1" }),
66
- mockChange({ id: "change2" }),
67
- mockChange({ id: "change3" }),
68
- mockChange({ id: "change4" }),
69
- ])
65
+ .values(mockChanges)
70
66
  .returningAll()
71
67
  .execute();
72
68
 
73
- const changes: VersionChange[] = [
74
- { version_id: versionA.id, change_id: "change1" },
75
- { version_id: versionA.id, change_id: "change2" },
76
- { version_id: versionB.id, change_id: "change1" },
77
- { version_id: versionB.id, change_id: "change2" },
78
- ];
79
-
80
- await lix.db.insertInto("version_change").values(changes).execute();
69
+ await updateChangesInVersion({
70
+ lix,
71
+ version: versionA,
72
+ changes: [mockChanges[0], mockChanges[1]],
73
+ });
74
+
75
+ await updateChangesInVersion({
76
+ lix,
77
+ version: versionB,
78
+ changes: [mockChanges[0], mockChanges[1]],
79
+ });
81
80
 
82
81
  const result = await lix.db
83
82
  .selectFrom("version_change")
@@ -1,6 +1,7 @@
1
1
  import { test, expect } from "vitest";
2
2
  import { createLsaInMemoryEnvironment } from "./create-in-memory-environment.js";
3
3
  import { openLixInMemory } from "../../lix/open-lix-in-memory.js";
4
+ import { toBlob } from "../../lix/to-blob.js";
4
5
 
5
6
  test("opening a lix works", async () => {
6
7
  const environment = createLsaInMemoryEnvironment();
@@ -14,7 +15,7 @@ test("opening a lix works", async () => {
14
15
  .executeTakeFirstOrThrow();
15
16
 
16
17
  // initialize the env with the lix file
17
- environment.setLix({ id: lixId, blob: await mockLix.toBlob() });
18
+ environment.setLix({ id: lixId, blob: await toBlob({ lix: mockLix }) });
18
19
 
19
20
  const open0 = await environment.openLix({ id: lixId });
20
21
 
@@ -24,7 +25,7 @@ test("opening a lix works", async () => {
24
25
  .returningAll()
25
26
  .executeTakeFirstOrThrow();
26
27
 
27
- expect(mockInsert).toEqual({
28
+ expect(mockInsert).toMatchObject({
28
29
  key: "foo",
29
30
  value: "bar",
30
31
  });
@@ -44,7 +45,7 @@ test("opening a lix works", async () => {
44
45
  .selectAll()
45
46
  .executeTakeFirstOrThrow();
46
47
 
47
- expect(mockSelect).toEqual({ key: "foo", value: "bar" });
48
+ expect(mockSelect).toMatchObject({ key: "foo", value: "bar" });
48
49
 
49
50
  await environment.closeLix({ id: lixId, connectionId: open1.connectionId });
50
51
  });
@@ -61,7 +62,7 @@ test("it handles concurrent connections", async () => {
61
62
  .executeTakeFirstOrThrow();
62
63
 
63
64
  // initialize the env with the lix file
64
- environment.setLix({ id: lixId, blob: await mockLix.toBlob() });
65
+ environment.setLix({ id: lixId, blob: await toBlob({ lix: mockLix }) });
65
66
 
66
67
  const open0 = await environment.openLix({ id: lixId });
67
68
  const open1 = await environment.openLix({ id: lixId });
@@ -72,7 +73,7 @@ test("it handles concurrent connections", async () => {
72
73
  .returningAll()
73
74
  .executeTakeFirstOrThrow();
74
75
 
75
- expect(mockInsert).toEqual({
76
+ expect(mockInsert).toMatchObject({
76
77
  key: "foo",
77
78
  value: "bar",
78
79
  });
@@ -83,7 +84,7 @@ test("it handles concurrent connections", async () => {
83
84
  .selectAll()
84
85
  .executeTakeFirstOrThrow();
85
86
 
86
- expect(mockSelect).toEqual({ key: "foo", value: "bar" });
87
+ expect(mockSelect).toMatchObject({ key: "foo", value: "bar" });
87
88
 
88
89
  // test both writing at the same time
89
90
 
@@ -124,7 +125,7 @@ test("it handles concurrent connections", async () => {
124
125
  .selectAll()
125
126
  .executeTakeFirstOrThrow();
126
127
 
127
- expect(mockSelect2).toEqual({ key: "foo", value: "bar3" });
128
+ expect(mockSelect2).toMatchObject({ key: "foo", value: "bar3" });
128
129
 
129
130
  await environment.closeLix({ id: lixId, connectionId: open2.connectionId });
130
131
  });