@lix-js/sdk 0.6.0-preview.5 → 0.6.1

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 (274) hide show
  1. package/README.md +76 -4
  2. package/dist/errors.d.ts +7 -0
  3. package/dist/errors.js +19 -0
  4. package/dist/index.d.ts +4 -5
  5. package/dist/index.js +3 -3
  6. package/dist/native.d.ts +1 -0
  7. package/dist/native.js +47 -0
  8. package/dist/open-lix.d.ts +38 -207
  9. package/dist/open-lix.js +59 -284
  10. package/dist/result.d.ts +18 -0
  11. package/dist/result.js +48 -0
  12. package/dist/types.d.ts +114 -1
  13. package/dist/value.d.ts +28 -0
  14. package/dist/value.js +245 -0
  15. package/package.json +38 -71
  16. package/SKILL.md +0 -507
  17. package/dist/builtin-schemas.d.ts +0 -1
  18. package/dist/builtin-schemas.js +0 -1
  19. package/dist/engine-wasm/index.d.ts +0 -87
  20. package/dist/engine-wasm/index.js +0 -339
  21. package/dist/engine-wasm/wasm/lix_engine.d.ts +0 -79
  22. package/dist/engine-wasm/wasm/lix_engine.js +0 -833
  23. package/dist/engine-wasm/wasm/lix_engine.wasm +0 -0
  24. package/dist/engine-wasm/wasm/lix_engine.wasm.d.ts +0 -27
  25. package/dist/generated/builtin-schemas.d.ts +0 -427
  26. package/dist/generated/builtin-schemas.js +0 -643
  27. package/dist/sqlite/index.d.ts +0 -12
  28. package/dist/sqlite/index.js +0 -359
  29. package/dist-engine-src/README.md +0 -18
  30. package/dist-engine-src/src/backend/capabilities.rs +0 -67
  31. package/dist-engine-src/src/backend/conformance/baseline.rs +0 -1127
  32. package/dist-engine-src/src/backend/conformance/factory.rs +0 -93
  33. package/dist-engine-src/src/backend/conformance/failure_tests.rs +0 -608
  34. package/dist-engine-src/src/backend/conformance/fixtures.rs +0 -26
  35. package/dist-engine-src/src/backend/conformance/mod.rs +0 -75
  36. package/dist-engine-src/src/backend/conformance/model.rs +0 -28
  37. package/dist-engine-src/src/backend/conformance/model_based.rs +0 -257
  38. package/dist-engine-src/src/backend/conformance/persistence.rs +0 -204
  39. package/dist-engine-src/src/backend/conformance/projection.rs +0 -21
  40. package/dist-engine-src/src/backend/conformance/pushdown.rs +0 -24
  41. package/dist-engine-src/src/backend/conformance/runner.rs +0 -90
  42. package/dist-engine-src/src/backend/conformance/scan.rs +0 -24
  43. package/dist-engine-src/src/backend/conformance/write.rs +0 -16
  44. package/dist-engine-src/src/backend/error.rs +0 -94
  45. package/dist-engine-src/src/backend/in_memory.rs +0 -670
  46. package/dist-engine-src/src/backend/mod.rs +0 -39
  47. package/dist-engine-src/src/backend/predicate.rs +0 -80
  48. package/dist-engine-src/src/backend/traits.rs +0 -260
  49. package/dist-engine-src/src/backend/types.rs +0 -239
  50. package/dist-engine-src/src/binary_cas/chunking.rs +0 -31
  51. package/dist-engine-src/src/binary_cas/codec.rs +0 -346
  52. package/dist-engine-src/src/binary_cas/context.rs +0 -139
  53. package/dist-engine-src/src/binary_cas/kv.rs +0 -1038
  54. package/dist-engine-src/src/binary_cas/mod.rs +0 -11
  55. package/dist-engine-src/src/binary_cas/types.rs +0 -121
  56. package/dist-engine-src/src/branch/context.rs +0 -40
  57. package/dist-engine-src/src/branch/lifecycle.rs +0 -221
  58. package/dist-engine-src/src/branch/mod.rs +0 -13
  59. package/dist-engine-src/src/branch/refs.rs +0 -321
  60. package/dist-engine-src/src/branch/stage_rows.rs +0 -67
  61. package/dist-engine-src/src/branch/types.rs +0 -21
  62. package/dist-engine-src/src/catalog/context.rs +0 -412
  63. package/dist-engine-src/src/catalog/mod.rs +0 -10
  64. package/dist-engine-src/src/catalog/schema.rs +0 -4
  65. package/dist-engine-src/src/catalog/snapshot.rs +0 -1114
  66. package/dist-engine-src/src/cel/context.rs +0 -86
  67. package/dist-engine-src/src/cel/error.rs +0 -19
  68. package/dist-engine-src/src/cel/mod.rs +0 -8
  69. package/dist-engine-src/src/cel/provider.rs +0 -9
  70. package/dist-engine-src/src/cel/runtime.rs +0 -167
  71. package/dist-engine-src/src/cel/value.rs +0 -50
  72. package/dist-engine-src/src/changelog/bench_support.rs +0 -785
  73. package/dist-engine-src/src/changelog/change.rs +0 -1
  74. package/dist-engine-src/src/changelog/codec.rs +0 -497
  75. package/dist-engine-src/src/changelog/commit.rs +0 -1
  76. package/dist-engine-src/src/changelog/context.rs +0 -1614
  77. package/dist-engine-src/src/changelog/mod.rs +0 -29
  78. package/dist-engine-src/src/changelog/store.rs +0 -163
  79. package/dist-engine-src/src/changelog/test_support.rs +0 -54
  80. package/dist-engine-src/src/changelog/types.rs +0 -213
  81. package/dist-engine-src/src/commit_graph/context.rs +0 -944
  82. package/dist-engine-src/src/commit_graph/mod.rs +0 -9
  83. package/dist-engine-src/src/commit_graph/types.rs +0 -89
  84. package/dist-engine-src/src/commit_graph/walker.rs +0 -786
  85. package/dist-engine-src/src/common/error.rs +0 -347
  86. package/dist-engine-src/src/common/fingerprint.rs +0 -3
  87. package/dist-engine-src/src/common/fs_path.rs +0 -1336
  88. package/dist-engine-src/src/common/identity.rs +0 -145
  89. package/dist-engine-src/src/common/json_pointer.rs +0 -67
  90. package/dist-engine-src/src/common/metadata.rs +0 -40
  91. package/dist-engine-src/src/common/mod.rs +0 -23
  92. package/dist-engine-src/src/common/types.rs +0 -105
  93. package/dist-engine-src/src/common/wire.rs +0 -222
  94. package/dist-engine-src/src/domain.rs +0 -320
  95. package/dist-engine-src/src/engine.rs +0 -203
  96. package/dist-engine-src/src/entity_pk.rs +0 -402
  97. package/dist-engine-src/src/functions/context.rs +0 -296
  98. package/dist-engine-src/src/functions/deterministic.rs +0 -113
  99. package/dist-engine-src/src/functions/mod.rs +0 -18
  100. package/dist-engine-src/src/functions/provider.rs +0 -130
  101. package/dist-engine-src/src/functions/state.rs +0 -335
  102. package/dist-engine-src/src/functions/types.rs +0 -37
  103. package/dist-engine-src/src/init.rs +0 -692
  104. package/dist-engine-src/src/json_store/compression.rs +0 -77
  105. package/dist-engine-src/src/json_store/context.rs +0 -172
  106. package/dist-engine-src/src/json_store/encoded.rs +0 -15
  107. package/dist-engine-src/src/json_store/mod.rs +0 -38
  108. package/dist-engine-src/src/json_store/store.rs +0 -494
  109. package/dist-engine-src/src/json_store/types.rs +0 -212
  110. package/dist-engine-src/src/lib.rs +0 -92
  111. package/dist-engine-src/src/live_state/context.rs +0 -1883
  112. package/dist-engine-src/src/live_state/mod.rs +0 -21
  113. package/dist-engine-src/src/live_state/overlay.rs +0 -75
  114. package/dist-engine-src/src/live_state/reader.rs +0 -23
  115. package/dist-engine-src/src/live_state/types.rs +0 -231
  116. package/dist-engine-src/src/live_state/visibility.rs +0 -666
  117. package/dist-engine-src/src/plugin/archive.rs +0 -438
  118. package/dist-engine-src/src/plugin/component.rs +0 -183
  119. package/dist-engine-src/src/plugin/install.rs +0 -619
  120. package/dist-engine-src/src/plugin/manifest.rs +0 -516
  121. package/dist-engine-src/src/plugin/materializer.rs +0 -202
  122. package/dist-engine-src/src/plugin/mod.rs +0 -33
  123. package/dist-engine-src/src/plugin/plugin_manifest.json +0 -119
  124. package/dist-engine-src/src/plugin/storage.rs +0 -74
  125. package/dist-engine-src/src/schema/annotations/defaults.rs +0 -275
  126. package/dist-engine-src/src/schema/annotations/mod.rs +0 -1
  127. package/dist-engine-src/src/schema/builtin/lix_account.json +0 -21
  128. package/dist-engine-src/src/schema/builtin/lix_active_account.json +0 -29
  129. package/dist-engine-src/src/schema/builtin/lix_binary_blob_ref.json +0 -29
  130. package/dist-engine-src/src/schema/builtin/lix_branch_descriptor.json +0 -34
  131. package/dist-engine-src/src/schema/builtin/lix_branch_ref.json +0 -48
  132. package/dist-engine-src/src/schema/builtin/lix_change.json +0 -63
  133. package/dist-engine-src/src/schema/builtin/lix_change_author.json +0 -45
  134. package/dist-engine-src/src/schema/builtin/lix_commit.json +0 -24
  135. package/dist-engine-src/src/schema/builtin/lix_commit_edge.json +0 -53
  136. package/dist-engine-src/src/schema/builtin/lix_directory_descriptor.json +0 -52
  137. package/dist-engine-src/src/schema/builtin/lix_file_descriptor.json +0 -52
  138. package/dist-engine-src/src/schema/builtin/lix_key_value.json +0 -40
  139. package/dist-engine-src/src/schema/builtin/lix_label.json +0 -29
  140. package/dist-engine-src/src/schema/builtin/lix_label_assignment.json +0 -74
  141. package/dist-engine-src/src/schema/builtin/lix_registered_schema.json +0 -25
  142. package/dist-engine-src/src/schema/builtin/mod.rs +0 -220
  143. package/dist-engine-src/src/schema/compatibility.rs +0 -787
  144. package/dist-engine-src/src/schema/definition.json +0 -187
  145. package/dist-engine-src/src/schema/definition.rs +0 -742
  146. package/dist-engine-src/src/schema/key.rs +0 -138
  147. package/dist-engine-src/src/schema/mod.rs +0 -20
  148. package/dist-engine-src/src/schema/seed.rs +0 -14
  149. package/dist-engine-src/src/schema/tests.rs +0 -780
  150. package/dist-engine-src/src/session/context.rs +0 -1059
  151. package/dist-engine-src/src/session/create_branch.rs +0 -94
  152. package/dist-engine-src/src/session/execute.rs +0 -681
  153. package/dist-engine-src/src/session/merge/analysis.rs +0 -108
  154. package/dist-engine-src/src/session/merge/branch.rs +0 -417
  155. package/dist-engine-src/src/session/merge/conflicts.rs +0 -63
  156. package/dist-engine-src/src/session/merge/mod.rs +0 -10
  157. package/dist-engine-src/src/session/merge/stats.rs +0 -61
  158. package/dist-engine-src/src/session/mod.rs +0 -30
  159. package/dist-engine-src/src/session/switch_branch.rs +0 -113
  160. package/dist-engine-src/src/session/transaction.rs +0 -557
  161. package/dist-engine-src/src/sql2/bind/classify.rs +0 -102
  162. package/dist-engine-src/src/sql2/bind/error.rs +0 -5
  163. package/dist-engine-src/src/sql2/bind/expr.rs +0 -29
  164. package/dist-engine-src/src/sql2/bind/mod.rs +0 -12
  165. package/dist-engine-src/src/sql2/bind/public_udf.rs +0 -306
  166. package/dist-engine-src/src/sql2/bind/read.rs +0 -65
  167. package/dist-engine-src/src/sql2/bind/statement.rs +0 -2236
  168. package/dist-engine-src/src/sql2/bind/table.rs +0 -273
  169. package/dist-engine-src/src/sql2/bind/write.rs +0 -86
  170. package/dist-engine-src/src/sql2/branch_scope.rs +0 -436
  171. package/dist-engine-src/src/sql2/catalog/capability.rs +0 -20
  172. package/dist-engine-src/src/sql2/catalog/entity_surface.rs +0 -296
  173. package/dist-engine-src/src/sql2/catalog/mod.rs +0 -15
  174. package/dist-engine-src/src/sql2/catalog/registry.rs +0 -556
  175. package/dist-engine-src/src/sql2/catalog/schema.rs +0 -88
  176. package/dist-engine-src/src/sql2/catalog/surface.rs +0 -41
  177. package/dist-engine-src/src/sql2/change_materialization.rs +0 -122
  178. package/dist-engine-src/src/sql2/context.rs +0 -317
  179. package/dist-engine-src/src/sql2/dml.rs +0 -148
  180. package/dist-engine-src/src/sql2/error.rs +0 -215
  181. package/dist-engine-src/src/sql2/exec/bound_public_write.rs +0 -1593
  182. package/dist-engine-src/src/sql2/exec/datafusion.rs +0 -5266
  183. package/dist-engine-src/src/sql2/exec/fast_write.rs +0 -82
  184. package/dist-engine-src/src/sql2/exec/mod.rs +0 -24
  185. package/dist-engine-src/src/sql2/exec/write.rs +0 -661
  186. package/dist-engine-src/src/sql2/filesystem_planner.rs +0 -1485
  187. package/dist-engine-src/src/sql2/filesystem_predicates.rs +0 -159
  188. package/dist-engine-src/src/sql2/filesystem_visibility.rs +0 -383
  189. package/dist-engine-src/src/sql2/history_projection.rs +0 -56
  190. package/dist-engine-src/src/sql2/history_route.rs +0 -661
  191. package/dist-engine-src/src/sql2/mod.rs +0 -52
  192. package/dist-engine-src/src/sql2/optimize/datafusion.rs +0 -1
  193. package/dist-engine-src/src/sql2/optimize/mod.rs +0 -2
  194. package/dist-engine-src/src/sql2/optimize/simple_write.rs +0 -116
  195. package/dist-engine-src/src/sql2/parse/mod.rs +0 -69
  196. package/dist-engine-src/src/sql2/parse/normalize.rs +0 -1
  197. package/dist-engine-src/src/sql2/plan/branch_scope.rs +0 -24
  198. package/dist-engine-src/src/sql2/plan/mod.rs +0 -5
  199. package/dist-engine-src/src/sql2/plan/predicate.rs +0 -22
  200. package/dist-engine-src/src/sql2/plan/write.rs +0 -147
  201. package/dist-engine-src/src/sql2/predicate_typecheck.rs +0 -504
  202. package/dist-engine-src/src/sql2/providers/branch.rs +0 -1206
  203. package/dist-engine-src/src/sql2/providers/change.rs +0 -445
  204. package/dist-engine-src/src/sql2/providers/directory.rs +0 -2422
  205. package/dist-engine-src/src/sql2/providers/directory_history.rs +0 -645
  206. package/dist-engine-src/src/sql2/providers/entity.rs +0 -1484
  207. package/dist-engine-src/src/sql2/providers/entity_history.rs +0 -452
  208. package/dist-engine-src/src/sql2/providers/file.rs +0 -3686
  209. package/dist-engine-src/src/sql2/providers/file_history.rs +0 -924
  210. package/dist-engine-src/src/sql2/providers/history.rs +0 -426
  211. package/dist-engine-src/src/sql2/providers/lix_state.rs +0 -2542
  212. package/dist-engine-src/src/sql2/providers/mod.rs +0 -508
  213. package/dist-engine-src/src/sql2/read_only.rs +0 -63
  214. package/dist-engine-src/src/sql2/record_batch.rs +0 -17
  215. package/dist-engine-src/src/sql2/result_metadata.rs +0 -29
  216. package/dist-engine-src/src/sql2/runtime.rs +0 -60
  217. package/dist-engine-src/src/sql2/session.rs +0 -83
  218. package/dist-engine-src/src/sql2/storage/constraints.rs +0 -1
  219. package/dist-engine-src/src/sql2/storage/mod.rs +0 -1
  220. package/dist-engine-src/src/sql2/test_support/differential.rs +0 -712
  221. package/dist-engine-src/src/sql2/test_support/generators.rs +0 -354
  222. package/dist-engine-src/src/sql2/test_support/mod.rs +0 -2
  223. package/dist-engine-src/src/sql2/udfs/common.rs +0 -295
  224. package/dist-engine-src/src/sql2/udfs/lix_active_branch_commit_id.rs +0 -53
  225. package/dist-engine-src/src/sql2/udfs/lix_empty_blob.rs +0 -47
  226. package/dist-engine-src/src/sql2/udfs/lix_json.rs +0 -100
  227. package/dist-engine-src/src/sql2/udfs/lix_json_get.rs +0 -99
  228. package/dist-engine-src/src/sql2/udfs/lix_json_get_text.rs +0 -99
  229. package/dist-engine-src/src/sql2/udfs/lix_text_decode.rs +0 -82
  230. package/dist-engine-src/src/sql2/udfs/lix_text_encode.rs +0 -85
  231. package/dist-engine-src/src/sql2/udfs/lix_timestamp.rs +0 -76
  232. package/dist-engine-src/src/sql2/udfs/lix_uuid_v7.rs +0 -76
  233. package/dist-engine-src/src/sql2/udfs/mod.rs +0 -86
  234. package/dist-engine-src/src/sql2/write_normalization.rs +0 -368
  235. package/dist-engine-src/src/storage/conformance.rs +0 -399
  236. package/dist-engine-src/src/storage/context.rs +0 -620
  237. package/dist-engine-src/src/storage/mod.rs +0 -52
  238. package/dist-engine-src/src/storage/point.rs +0 -440
  239. package/dist-engine-src/src/storage/read_scope.rs +0 -67
  240. package/dist-engine-src/src/storage/reader.rs +0 -867
  241. package/dist-engine-src/src/storage/scan.rs +0 -784
  242. package/dist-engine-src/src/storage/spaces.rs +0 -236
  243. package/dist-engine-src/src/storage/stats.rs +0 -80
  244. package/dist-engine-src/src/storage/write_set.rs +0 -962
  245. package/dist-engine-src/src/storage_bench.rs +0 -171
  246. package/dist-engine-src/src/test_support.rs +0 -450
  247. package/dist-engine-src/src/tracked_state/bench_support.rs +0 -394
  248. package/dist-engine-src/src/tracked_state/codec.rs +0 -1183
  249. package/dist-engine-src/src/tracked_state/commit_root_rebuild.rs +0 -358
  250. package/dist-engine-src/src/tracked_state/context.rs +0 -2801
  251. package/dist-engine-src/src/tracked_state/diff.rs +0 -2140
  252. package/dist-engine-src/src/tracked_state/merge.rs +0 -478
  253. package/dist-engine-src/src/tracked_state/mod.rs +0 -35
  254. package/dist-engine-src/src/tracked_state/row_materialization.rs +0 -275
  255. package/dist-engine-src/src/tracked_state/storage.rs +0 -427
  256. package/dist-engine-src/src/tracked_state/tree.rs +0 -3063
  257. package/dist-engine-src/src/tracked_state/types.rs +0 -238
  258. package/dist-engine-src/src/transaction/bench_support.rs +0 -407
  259. package/dist-engine-src/src/transaction/commit.rs +0 -1592
  260. package/dist-engine-src/src/transaction/context.rs +0 -1653
  261. package/dist-engine-src/src/transaction/mod.rs +0 -24
  262. package/dist-engine-src/src/transaction/normalization.rs +0 -877
  263. package/dist-engine-src/src/transaction/prep.rs +0 -37
  264. package/dist-engine-src/src/transaction/schema_resolver.rs +0 -163
  265. package/dist-engine-src/src/transaction/staging.rs +0 -1525
  266. package/dist-engine-src/src/transaction/types.rs +0 -403
  267. package/dist-engine-src/src/transaction/validation.rs +0 -5766
  268. package/dist-engine-src/src/untracked_state/codec.rs +0 -615
  269. package/dist-engine-src/src/untracked_state/context.rs +0 -98
  270. package/dist-engine-src/src/untracked_state/materialization.rs +0 -63
  271. package/dist-engine-src/src/untracked_state/mod.rs +0 -15
  272. package/dist-engine-src/src/untracked_state/storage.rs +0 -898
  273. package/dist-engine-src/src/untracked_state/types.rs +0 -146
  274. package/dist-engine-src/src/wasm/mod.rs +0 -60
@@ -1,63 +0,0 @@
1
- {
2
- "x-lix-key": "lix_change",
3
- "description": "A change records one edit to a Lix entity, including what changed, when it changed, and which entity was affected.",
4
- "x-lix-primary-key": [
5
- "/id"
6
- ],
7
- "type": "object",
8
- "properties": {
9
- "id": {
10
- "type": "string",
11
- "x-lix-default": "lix_uuid_v7()",
12
- "description": "Stable identifier for this change."
13
- },
14
- "entity_pk": {
15
- "type": "array",
16
- "description": "Canonical JSON primary-key tuple for the entity this change applies to, scoped by (`schema_key`, `file_id`). Values are ordered according to the target schema's `x-lix-primary-key`.",
17
- "items": {
18
- "type": "string"
19
- },
20
- "minItems": 1
21
- },
22
- "schema_key": {
23
- "type": "string",
24
- "description": "Schema identifier of the entity (e.g. `lix_file_descriptor`, `lix_commit`, or a user-registered key)."
25
- },
26
- "file_id": {
27
- "type": [
28
- "string",
29
- "null"
30
- ],
31
- "description": "Filesystem-scoped file identifier when the change belongs to a file; NULL for engine-internal entities (commits, branches, settings)."
32
- },
33
- "metadata": {
34
- "type": [
35
- "object",
36
- "null"
37
- ],
38
- "description": "Optional user-provided JSON metadata attached to the change; NULL when nothing was supplied."
39
- },
40
- "created_at": {
41
- "type": "string",
42
- "examples": [
43
- "2026-05-08T17:42:31.123Z"
44
- ],
45
- "description": "ISO-8601 timestamp at which the change was recorded (set via `lix_timestamp()` at write time)."
46
- },
47
- "snapshot_content": {
48
- "type": [
49
- "object",
50
- "null"
51
- ],
52
- "description": "Entity JSON body at this change; NULL represents a tombstone (deletion)."
53
- }
54
- },
55
- "required": [
56
- "id",
57
- "entity_pk",
58
- "schema_key",
59
- "file_id",
60
- "created_at"
61
- ],
62
- "additionalProperties": false
63
- }
@@ -1,45 +0,0 @@
1
- {
2
- "x-lix-key": "lix_change_author",
3
- "x-lix-primary-key": [
4
- "/change_id",
5
- "/account_id"
6
- ],
7
- "x-lix-foreign-keys": [
8
- {
9
- "properties": [
10
- "/change_id"
11
- ],
12
- "references": {
13
- "schemaKey": "lix_change",
14
- "properties": [
15
- "/id"
16
- ]
17
- }
18
- },
19
- {
20
- "properties": [
21
- "/account_id"
22
- ],
23
- "references": {
24
- "schemaKey": "lix_account",
25
- "properties": [
26
- "/id"
27
- ]
28
- }
29
- }
30
- ],
31
- "type": "object",
32
- "properties": {
33
- "change_id": {
34
- "type": "string"
35
- },
36
- "account_id": {
37
- "type": "string"
38
- }
39
- },
40
- "required": [
41
- "change_id",
42
- "account_id"
43
- ],
44
- "additionalProperties": false
45
- }
@@ -1,24 +0,0 @@
1
- {
2
- "x-lix-key": "lix_commit",
3
- "description": "A commit is a stable point in project history. Branches point to commits. Use lix_commit_edge to inspect parent commits.",
4
- "examples": [
5
- {
6
- "id": "commit_01jexample"
7
- }
8
- ],
9
- "x-lix-primary-key": [
10
- "/id"
11
- ],
12
- "type": "object",
13
- "properties": {
14
- "id": {
15
- "type": "string",
16
- "x-lix-default": "lix_uuid_v7()",
17
- "description": "Stable identifier of this commit."
18
- }
19
- },
20
- "required": [
21
- "id"
22
- ],
23
- "additionalProperties": false
24
- }
@@ -1,53 +0,0 @@
1
- {
2
- "x-lix-key": "lix_commit_edge",
3
- "description": "Direct parent relationship between two commits. Merge commits have one row per parent. The first parent is useful for showing mainline history or comparing a merge commit against the commit that was checked out before the merge.",
4
- "examples": [
5
- {
6
- "parent_id": "commit-main",
7
- "child_id": "commit-merge",
8
- "parent_order": 0
9
- },
10
- {
11
- "parent_id": "commit-feature",
12
- "child_id": "commit-merge",
13
- "parent_order": 1
14
- }
15
- ],
16
- "x-lix-primary-key": ["/child_id", "/parent_order"],
17
- "x-lix-unique": [["/parent_id", "/child_id"]],
18
- "x-lix-foreign-keys": [
19
- {
20
- "properties": ["/parent_id"],
21
- "references": {
22
- "schemaKey": "lix_commit",
23
- "properties": ["/id"]
24
- }
25
- },
26
- {
27
- "properties": ["/child_id"],
28
- "references": {
29
- "schemaKey": "lix_commit",
30
- "properties": ["/id"]
31
- }
32
- }
33
- ],
34
- "type": "object",
35
- "properties": {
36
- "parent_id": {
37
- "type": "string",
38
- "description": "Identifier of the parent commit."
39
- },
40
- "child_id": {
41
- "type": "string",
42
- "description": "Identifier of the child commit."
43
- },
44
- "parent_order": {
45
- "type": "integer",
46
- "minimum": 0,
47
- "examples": [0, 1],
48
- "description": "Zero-based position of this parent in the child commit's ordered parent list. The first parent has order 0; additional merge parents have order 1, 2, and so on."
49
- }
50
- },
51
- "required": ["parent_id", "child_id", "parent_order"],
52
- "additionalProperties": false
53
- }
@@ -1,52 +0,0 @@
1
- {
2
- "x-lix-key": "lix_directory_descriptor",
3
- "x-lix-primary-key": [
4
- "/id"
5
- ],
6
- "x-lix-unique": [
7
- [
8
- "/parent_id",
9
- "/name"
10
- ]
11
- ],
12
- "x-lix-foreign-keys": [
13
- {
14
- "properties": [
15
- "/parent_id"
16
- ],
17
- "references": {
18
- "schemaKey": "lix_directory_descriptor",
19
- "properties": [
20
- "/id"
21
- ]
22
- }
23
- }
24
- ],
25
- "type": "object",
26
- "properties": {
27
- "id": {
28
- "type": "string",
29
- "x-lix-default": "lix_uuid_v7()"
30
- },
31
- "parent_id": {
32
- "type": [
33
- "string",
34
- "null"
35
- ]
36
- },
37
- "name": {
38
- "type": "string",
39
- "pattern": "^(?!\\.{1,2}$)[^/\\\\]+$"
40
- },
41
- "hidden": {
42
- "type": "boolean",
43
- "x-lix-default": "false"
44
- }
45
- },
46
- "required": [
47
- "id",
48
- "parent_id",
49
- "name"
50
- ],
51
- "additionalProperties": false
52
- }
@@ -1,52 +0,0 @@
1
- {
2
- "x-lix-key": "lix_file_descriptor",
3
- "x-lix-primary-key": [
4
- "/id"
5
- ],
6
- "x-lix-unique": [
7
- [
8
- "/directory_id",
9
- "/name"
10
- ]
11
- ],
12
- "x-lix-foreign-keys": [
13
- {
14
- "properties": [
15
- "/directory_id"
16
- ],
17
- "references": {
18
- "schemaKey": "lix_directory_descriptor",
19
- "properties": [
20
- "/id"
21
- ]
22
- }
23
- }
24
- ],
25
- "type": "object",
26
- "properties": {
27
- "id": {
28
- "type": "string",
29
- "x-lix-default": "lix_uuid_v7()"
30
- },
31
- "directory_id": {
32
- "type": [
33
- "string",
34
- "null"
35
- ]
36
- },
37
- "name": {
38
- "type": "string",
39
- "pattern": "^(?!\\.{1,2}$)[^/\\\\]+$"
40
- },
41
- "hidden": {
42
- "type": "boolean",
43
- "x-lix-default": "false"
44
- }
45
- },
46
- "required": [
47
- "id",
48
- "directory_id",
49
- "name"
50
- ],
51
- "additionalProperties": false
52
- }
@@ -1,40 +0,0 @@
1
- {
2
- "x-lix-key": "lix_key_value",
3
- "x-lix-primary-key": [
4
- "/key"
5
- ],
6
- "type": "object",
7
- "properties": {
8
- "key": {
9
- "type": "string"
10
- },
11
- "value": {
12
- "description": "Arbitrary JSON value. This field stays in the JSON domain even when different rows hold different JSON kinds.",
13
- "anyOf": [
14
- {
15
- "type": "object"
16
- },
17
- {
18
- "type": "array"
19
- },
20
- {
21
- "type": "string"
22
- },
23
- {
24
- "type": "number"
25
- },
26
- {
27
- "type": "boolean"
28
- },
29
- {
30
- "type": "null"
31
- }
32
- ]
33
- }
34
- },
35
- "required": [
36
- "key",
37
- "value"
38
- ],
39
- "additionalProperties": false
40
- }
@@ -1,29 +0,0 @@
1
- {
2
- "x-lix-key": "lix_label",
3
- "description": "Catalog of labels that can be assigned to arbitrary live Lix rows through lix_label_assignment.",
4
- "x-lix-primary-key": [
5
- "/id"
6
- ],
7
- "x-lix-unique": [
8
- [
9
- "/name"
10
- ]
11
- ],
12
- "type": "object",
13
- "properties": {
14
- "id": {
15
- "type": "string",
16
- "x-lix-default": "lix_uuid_v7()",
17
- "description": "Stable label identifier. Label assignments reference this value."
18
- },
19
- "name": {
20
- "type": "string",
21
- "description": "Human-readable label name. Unique across labels."
22
- }
23
- },
24
- "required": [
25
- "id",
26
- "name"
27
- ],
28
- "additionalProperties": false
29
- }
@@ -1,74 +0,0 @@
1
- {
2
- "x-lix-key": "lix_label_assignment",
3
- "description": "Mapping table that assigns a label to any live Lix row addressed by (target_entity_pk, target_schema_key, target_file_id). The state foreign-key tuple is ordered as [0] target_entity_pk, [1] target_schema_key, [2] target_file_id.",
4
- "x-lix-primary-key": [
5
- "/id"
6
- ],
7
- "x-lix-unique": [
8
- [
9
- "/target_entity_pk",
10
- "/target_schema_key",
11
- "/target_file_id",
12
- "/label_id"
13
- ]
14
- ],
15
- "x-lix-state-foreign-keys": [
16
- [
17
- "/target_entity_pk",
18
- "/target_schema_key",
19
- "/target_file_id"
20
- ]
21
- ],
22
- "x-lix-foreign-keys": [
23
- {
24
- "properties": [
25
- "/label_id"
26
- ],
27
- "references": {
28
- "schemaKey": "lix_label",
29
- "properties": [
30
- "/id"
31
- ]
32
- }
33
- }
34
- ],
35
- "type": "object",
36
- "properties": {
37
- "id": {
38
- "type": "string",
39
- "x-lix-default": "lix_uuid_v7()",
40
- "description": "Stable identifier for this label assignment row."
41
- },
42
- "target_entity_pk": {
43
- "type": "array",
44
- "description": "Target row entity_pk. This is slot [0] in x-lix-state-foreign-keys and must be the canonical JSON array of string primary-key parts.",
45
- "items": {
46
- "type": "string"
47
- },
48
- "minItems": 1
49
- },
50
- "target_schema_key": {
51
- "type": "string",
52
- "description": "Target row schema key. This is slot [1] in x-lix-state-foreign-keys."
53
- },
54
- "target_file_id": {
55
- "type": [
56
- "string",
57
- "null"
58
- ],
59
- "description": "Target row file scope. This is slot [2] in x-lix-state-foreign-keys; null targets global rows."
60
- },
61
- "label_id": {
62
- "type": "string",
63
- "description": "Label assigned to the target row. References lix_label.id."
64
- }
65
- },
66
- "required": [
67
- "id",
68
- "target_entity_pk",
69
- "target_schema_key",
70
- "target_file_id",
71
- "label_id"
72
- ],
73
- "additionalProperties": false
74
- }
@@ -1,25 +0,0 @@
1
- {
2
- "x-lix-key": "lix_registered_schema",
3
- "x-lix-primary-key": [
4
- "/value/x-lix-key"
5
- ],
6
- "type": "object",
7
- "properties": {
8
- "value": {
9
- "type": "object",
10
- "properties": {
11
- "x-lix-key": {
12
- "type": "string"
13
- }
14
- },
15
- "required": [
16
- "x-lix-key"
17
- ],
18
- "additionalProperties": true
19
- }
20
- },
21
- "required": [
22
- "value"
23
- ],
24
- "additionalProperties": false
25
- }
@@ -1,220 +0,0 @@
1
- use serde_json::Value as JsonValue;
2
- use std::sync::OnceLock;
3
-
4
- use crate::schema::lix_schema_definition;
5
-
6
- const LIX_REGISTERED_SCHEMA_KEY: &str = "lix_registered_schema";
7
- const LIX_KEY_VALUE_SCHEMA_KEY: &str = "lix_key_value";
8
- const LIX_ACCOUNT_SCHEMA_KEY: &str = "lix_account";
9
- const LIX_ACTIVE_ACCOUNT_SCHEMA_KEY: &str = "lix_active_account";
10
- const LIX_LABEL_SCHEMA_KEY: &str = "lix_label";
11
- const LIX_LABEL_ASSIGNMENT_SCHEMA_KEY: &str = "lix_label_assignment";
12
- const LIX_CHANGE_SCHEMA_KEY: &str = "lix_change";
13
- const LIX_CHANGE_AUTHOR_SCHEMA_KEY: &str = "lix_change_author";
14
- const LIX_COMMIT_SCHEMA_KEY: &str = "lix_commit";
15
- const LIX_BRANCH_DESCRIPTOR_SCHEMA_KEY: &str = "lix_branch_descriptor";
16
- const LIX_BRANCH_REF_SCHEMA_KEY: &str = "lix_branch_ref";
17
- const LIX_COMMIT_EDGE_SCHEMA_KEY: &str = "lix_commit_edge";
18
- const LIX_FILE_DESCRIPTOR_SCHEMA_KEY: &str = "lix_file_descriptor";
19
- const LIX_DIRECTORY_DESCRIPTOR_SCHEMA_KEY: &str = "lix_directory_descriptor";
20
- const LIX_BINARY_BLOB_REF_SCHEMA_KEY: &str = "lix_binary_blob_ref";
21
-
22
- const LIX_REGISTERED_SCHEMA_JSON: &str = include_str!("lix_registered_schema.json");
23
- const LIX_KEY_VALUE_SCHEMA_JSON: &str = include_str!("lix_key_value.json");
24
- const LIX_ACCOUNT_SCHEMA_JSON: &str = include_str!("lix_account.json");
25
- const LIX_ACTIVE_ACCOUNT_SCHEMA_JSON: &str = include_str!("lix_active_account.json");
26
- const LIX_LABEL_SCHEMA_JSON: &str = include_str!("lix_label.json");
27
- const LIX_LABEL_ASSIGNMENT_SCHEMA_JSON: &str = include_str!("lix_label_assignment.json");
28
- const LIX_CHANGE_SCHEMA_JSON: &str = include_str!("lix_change.json");
29
- const LIX_CHANGE_AUTHOR_SCHEMA_JSON: &str = include_str!("lix_change_author.json");
30
- const LIX_COMMIT_SCHEMA_JSON: &str = include_str!("lix_commit.json");
31
- const LIX_BRANCH_DESCRIPTOR_SCHEMA_JSON: &str = include_str!("lix_branch_descriptor.json");
32
- const LIX_BRANCH_REF_SCHEMA_JSON: &str = include_str!("lix_branch_ref.json");
33
- const LIX_COMMIT_EDGE_SCHEMA_JSON: &str = include_str!("lix_commit_edge.json");
34
- const LIX_FILE_DESCRIPTOR_SCHEMA_JSON: &str = include_str!("lix_file_descriptor.json");
35
- const LIX_DIRECTORY_DESCRIPTOR_SCHEMA_JSON: &str = include_str!("lix_directory_descriptor.json");
36
- const LIX_BINARY_BLOB_REF_SCHEMA_JSON: &str = include_str!("lix_binary_blob_ref.json");
37
-
38
- static LIX_REGISTERED_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
39
- static LIX_KEY_VALUE_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
40
- static LIX_ACCOUNT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
41
- static LIX_ACTIVE_ACCOUNT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
42
- static LIX_LABEL_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
43
- static LIX_LABEL_ASSIGNMENT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
44
- static LIX_CHANGE_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
45
- static LIX_CHANGE_AUTHOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
46
- static LIX_COMMIT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
47
- static LIX_BRANCH_DESCRIPTOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
48
- static LIX_BRANCH_REF_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
49
- static LIX_COMMIT_EDGE_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
50
- static LIX_FILE_DESCRIPTOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
51
- static LIX_DIRECTORY_DESCRIPTOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
52
- static LIX_BINARY_BLOB_REF_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
53
-
54
- const BUILTIN_SCHEMA_KEYS: &[&str] = &[
55
- LIX_REGISTERED_SCHEMA_KEY,
56
- LIX_KEY_VALUE_SCHEMA_KEY,
57
- LIX_ACCOUNT_SCHEMA_KEY,
58
- LIX_ACTIVE_ACCOUNT_SCHEMA_KEY,
59
- LIX_LABEL_SCHEMA_KEY,
60
- LIX_LABEL_ASSIGNMENT_SCHEMA_KEY,
61
- LIX_CHANGE_SCHEMA_KEY,
62
- LIX_CHANGE_AUTHOR_SCHEMA_KEY,
63
- LIX_COMMIT_SCHEMA_KEY,
64
- LIX_BRANCH_DESCRIPTOR_SCHEMA_KEY,
65
- LIX_BRANCH_REF_SCHEMA_KEY,
66
- LIX_COMMIT_EDGE_SCHEMA_KEY,
67
- LIX_FILE_DESCRIPTOR_SCHEMA_KEY,
68
- LIX_DIRECTORY_DESCRIPTOR_SCHEMA_KEY,
69
- LIX_BINARY_BLOB_REF_SCHEMA_KEY,
70
- ];
71
-
72
- pub(super) fn is_seed_schema_key(schema_key: &str) -> bool {
73
- BUILTIN_SCHEMA_KEYS.contains(&schema_key)
74
- }
75
-
76
- pub(super) fn seed_schema_definitions() -> Vec<&'static JsonValue> {
77
- BUILTIN_SCHEMA_KEYS
78
- .iter()
79
- .map(|schema_key| {
80
- seed_schema_definition(schema_key)
81
- .unwrap_or_else(|| panic!("missing seed schema definition for '{schema_key}'"))
82
- })
83
- .collect()
84
- }
85
-
86
- pub(super) fn seed_schema_definition(schema_key: &str) -> Option<&'static JsonValue> {
87
- match schema_key {
88
- LIX_REGISTERED_SCHEMA_KEY => Some(
89
- LIX_REGISTERED_SCHEMA.get_or_init(|| parse_registered_schema_with_inlined_definition()),
90
- ),
91
- LIX_KEY_VALUE_SCHEMA_KEY => {
92
- Some(LIX_KEY_VALUE_SCHEMA.get_or_init(|| {
93
- parse_builtin_schema("lix_key_value.json", LIX_KEY_VALUE_SCHEMA_JSON)
94
- }))
95
- }
96
- LIX_ACCOUNT_SCHEMA_KEY => Some(
97
- LIX_ACCOUNT_SCHEMA
98
- .get_or_init(|| parse_builtin_schema("lix_account.json", LIX_ACCOUNT_SCHEMA_JSON)),
99
- ),
100
- LIX_ACTIVE_ACCOUNT_SCHEMA_KEY => Some(LIX_ACTIVE_ACCOUNT_SCHEMA.get_or_init(|| {
101
- parse_builtin_schema("lix_active_account.json", LIX_ACTIVE_ACCOUNT_SCHEMA_JSON)
102
- })),
103
- LIX_LABEL_SCHEMA_KEY => Some(
104
- LIX_LABEL_SCHEMA
105
- .get_or_init(|| parse_builtin_schema("lix_label.json", LIX_LABEL_SCHEMA_JSON)),
106
- ),
107
- LIX_LABEL_ASSIGNMENT_SCHEMA_KEY => Some(LIX_LABEL_ASSIGNMENT_SCHEMA.get_or_init(|| {
108
- parse_builtin_schema(
109
- "lix_label_assignment.json",
110
- LIX_LABEL_ASSIGNMENT_SCHEMA_JSON,
111
- )
112
- })),
113
- LIX_CHANGE_SCHEMA_KEY => Some(
114
- LIX_CHANGE_SCHEMA
115
- .get_or_init(|| parse_builtin_schema("lix_change.json", LIX_CHANGE_SCHEMA_JSON)),
116
- ),
117
- LIX_CHANGE_AUTHOR_SCHEMA_KEY => Some(LIX_CHANGE_AUTHOR_SCHEMA.get_or_init(|| {
118
- parse_builtin_schema("lix_change_author.json", LIX_CHANGE_AUTHOR_SCHEMA_JSON)
119
- })),
120
- LIX_COMMIT_SCHEMA_KEY => Some(
121
- LIX_COMMIT_SCHEMA
122
- .get_or_init(|| parse_builtin_schema("lix_commit.json", LIX_COMMIT_SCHEMA_JSON)),
123
- ),
124
- LIX_BRANCH_DESCRIPTOR_SCHEMA_KEY => Some(LIX_BRANCH_DESCRIPTOR_SCHEMA.get_or_init(|| {
125
- parse_builtin_schema(
126
- "lix_branch_descriptor.json",
127
- LIX_BRANCH_DESCRIPTOR_SCHEMA_JSON,
128
- )
129
- })),
130
- LIX_BRANCH_REF_SCHEMA_KEY => Some(LIX_BRANCH_REF_SCHEMA.get_or_init(|| {
131
- parse_builtin_schema("lix_branch_ref.json", LIX_BRANCH_REF_SCHEMA_JSON)
132
- })),
133
- LIX_COMMIT_EDGE_SCHEMA_KEY => Some(LIX_COMMIT_EDGE_SCHEMA.get_or_init(|| {
134
- parse_builtin_schema("lix_commit_edge.json", LIX_COMMIT_EDGE_SCHEMA_JSON)
135
- })),
136
- LIX_FILE_DESCRIPTOR_SCHEMA_KEY => Some(LIX_FILE_DESCRIPTOR_SCHEMA.get_or_init(|| {
137
- parse_builtin_schema("lix_file_descriptor.json", LIX_FILE_DESCRIPTOR_SCHEMA_JSON)
138
- })),
139
- LIX_DIRECTORY_DESCRIPTOR_SCHEMA_KEY => {
140
- Some(LIX_DIRECTORY_DESCRIPTOR_SCHEMA.get_or_init(|| {
141
- parse_builtin_schema(
142
- "lix_directory_descriptor.json",
143
- LIX_DIRECTORY_DESCRIPTOR_SCHEMA_JSON,
144
- )
145
- }))
146
- }
147
- LIX_BINARY_BLOB_REF_SCHEMA_KEY => Some(LIX_BINARY_BLOB_REF_SCHEMA.get_or_init(|| {
148
- parse_builtin_schema("lix_binary_blob_ref.json", LIX_BINARY_BLOB_REF_SCHEMA_JSON)
149
- })),
150
- _ => None,
151
- }
152
- }
153
-
154
- #[allow(dead_code)]
155
- pub(crate) fn builtin_schema_json(schema_key: &str) -> Option<&'static str> {
156
- match schema_key {
157
- LIX_REGISTERED_SCHEMA_KEY => Some(LIX_REGISTERED_SCHEMA_JSON),
158
- LIX_KEY_VALUE_SCHEMA_KEY => Some(LIX_KEY_VALUE_SCHEMA_JSON),
159
- LIX_ACCOUNT_SCHEMA_KEY => Some(LIX_ACCOUNT_SCHEMA_JSON),
160
- LIX_ACTIVE_ACCOUNT_SCHEMA_KEY => Some(LIX_ACTIVE_ACCOUNT_SCHEMA_JSON),
161
- LIX_LABEL_SCHEMA_KEY => Some(LIX_LABEL_SCHEMA_JSON),
162
- LIX_LABEL_ASSIGNMENT_SCHEMA_KEY => Some(LIX_LABEL_ASSIGNMENT_SCHEMA_JSON),
163
- LIX_CHANGE_SCHEMA_KEY => Some(LIX_CHANGE_SCHEMA_JSON),
164
- LIX_CHANGE_AUTHOR_SCHEMA_KEY => Some(LIX_CHANGE_AUTHOR_SCHEMA_JSON),
165
- LIX_COMMIT_SCHEMA_KEY => Some(LIX_COMMIT_SCHEMA_JSON),
166
- LIX_BRANCH_DESCRIPTOR_SCHEMA_KEY => Some(LIX_BRANCH_DESCRIPTOR_SCHEMA_JSON),
167
- LIX_BRANCH_REF_SCHEMA_KEY => Some(LIX_BRANCH_REF_SCHEMA_JSON),
168
- LIX_COMMIT_EDGE_SCHEMA_KEY => Some(LIX_COMMIT_EDGE_SCHEMA_JSON),
169
- LIX_FILE_DESCRIPTOR_SCHEMA_KEY => Some(LIX_FILE_DESCRIPTOR_SCHEMA_JSON),
170
- LIX_DIRECTORY_DESCRIPTOR_SCHEMA_KEY => Some(LIX_DIRECTORY_DESCRIPTOR_SCHEMA_JSON),
171
- LIX_BINARY_BLOB_REF_SCHEMA_KEY => Some(LIX_BINARY_BLOB_REF_SCHEMA_JSON),
172
- _ => None,
173
- }
174
- }
175
-
176
- fn parse_builtin_schema(file_name: &str, raw_json: &str) -> JsonValue {
177
- serde_json::from_str(raw_json).unwrap_or_else(|error| {
178
- panic!("builtin schema file '{file_name}' must contain valid JSON: {error}")
179
- })
180
- }
181
-
182
- fn parse_registered_schema_with_inlined_definition() -> JsonValue {
183
- let mut schema = parse_builtin_schema("lix_registered_schema.json", LIX_REGISTERED_SCHEMA_JSON);
184
- let value_schema = schema
185
- .pointer_mut("/properties/value")
186
- .expect("lix_registered_schema.json must define /properties/value");
187
- let value_schema_object = value_schema
188
- .as_object_mut()
189
- .expect("lix_registered_schema.json /properties/value must be an object");
190
-
191
- value_schema_object.insert(
192
- "allOf".to_string(),
193
- JsonValue::Array(vec![lix_schema_definition().clone()]),
194
- );
195
-
196
- schema
197
- }
198
-
199
- #[cfg(test)]
200
- mod tests {
201
- use super::{seed_schema_definition, BUILTIN_SCHEMA_KEYS};
202
-
203
- #[test]
204
- fn builtin_schemas_load_without_extra_override_metadata() {
205
- for schema_key in BUILTIN_SCHEMA_KEYS {
206
- seed_schema_definition(schema_key).expect("schema should exist");
207
- }
208
- }
209
-
210
- #[test]
211
- fn registered_schema_value_inlines_lix_schema_definition() {
212
- let schema = seed_schema_definition("lix_registered_schema").expect("schema should exist");
213
- let all_of = schema
214
- .pointer("/properties/value/allOf")
215
- .and_then(|value| value.as_array())
216
- .expect("registered schema value must define allOf array");
217
- assert_eq!(all_of.len(), 1);
218
- assert_eq!(all_of[0], *crate::schema::lix_schema_definition());
219
- }
220
- }