@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,33 +0,0 @@
1
- //! Plugin subsystem root.
2
- //!
3
- //! Phase 1 establishes `crate::plugin::*` as the owner path for plugin-domain
4
- //! code under concrete plugin-owned modules instead of legacy ownership-neutral
5
- //! buckets.
6
-
7
- mod archive;
8
- pub(crate) mod component;
9
- mod manifest;
10
- mod materializer;
11
- mod storage;
12
-
13
- pub(crate) use archive::{
14
- load_installed_plugin_from_archive_bytes, parse_plugin_archive_for_install, ParsedPluginArchive,
15
- };
16
- #[allow(unused_imports)]
17
- pub(crate) use manifest::{
18
- glob_matches_path, parse_plugin_manifest_json, select_best_glob_match, DetectChangesConfig,
19
- DetectStateContextConfig, PluginContentType, PluginManifest, PluginMatch, PluginRuntime,
20
- StateContextColumn, ValidatedPluginManifest,
21
- };
22
- #[allow(unused_imports)]
23
- pub(crate) use materializer::{
24
- installed_plugin_manifest_key_exists, invalidate_installed_plugins_cache,
25
- list_installed_plugin_manifest_keys, load_installed_plugins_from_backend_state,
26
- load_installed_plugins_with_runtime_cache, FilesystemPluginMaterializer, InstalledPlugin,
27
- PluginMaterializationHost,
28
- };
29
- #[allow(unused_imports)]
30
- pub(crate) use storage::{
31
- plugin_key_from_archive_path, plugin_storage_archive_file_id, plugin_storage_archive_path,
32
- PLUGIN_ARCHIVE_FILE_EXTENSION, PLUGIN_STORAGE_ROOT_DIRECTORY_PATH,
33
- };
@@ -1,119 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "type": "object",
4
- "additionalProperties": false,
5
- "required": [
6
- "key",
7
- "runtime",
8
- "api_version",
9
- "match",
10
- "entry",
11
- "schemas"
12
- ],
13
- "properties": {
14
- "key": {
15
- "type": "string",
16
- "minLength": 1,
17
- "maxLength": 128,
18
- "pattern": "^[a-z][a-z0-9_-]*$"
19
- },
20
- "runtime": {
21
- "type": "string",
22
- "enum": [
23
- "wasm-component-v1"
24
- ]
25
- },
26
- "api_version": {
27
- "type": "string",
28
- "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
29
- },
30
- "match": {
31
- "type": "object",
32
- "additionalProperties": false,
33
- "required": ["path_glob"],
34
- "properties": {
35
- "path_glob": {
36
- "type": "string",
37
- "minLength": 1
38
- },
39
- "content_type": {
40
- "type": "string",
41
- "enum": ["text", "binary"]
42
- }
43
- }
44
- },
45
- "detect_changes": {
46
- "type": "object",
47
- "additionalProperties": false,
48
- "properties": {
49
- "state_context": {
50
- "type": "object",
51
- "additionalProperties": false,
52
- "properties": {
53
- "include_active_state": {
54
- "type": "boolean"
55
- },
56
- "columns": {
57
- "type": "array",
58
- "minItems": 1,
59
- "uniqueItems": true,
60
- "items": {
61
- "type": "string",
62
- "enum": [
63
- "entity_pk",
64
- "schema_key",
65
- "schema_version",
66
- "snapshot_content",
67
- "file_id",
68
- "plugin_key",
69
- "branch_id",
70
- "change_id",
71
- "metadata",
72
- "created_at",
73
- "updated_at"
74
- ]
75
- },
76
- "contains": {
77
- "const": "entity_pk"
78
- }
79
- }
80
- },
81
- "allOf": [
82
- {
83
- "if": {
84
- "properties": {
85
- "include_active_state": {
86
- "const": true
87
- }
88
- },
89
- "required": [
90
- "include_active_state"
91
- ]
92
- },
93
- "then": {},
94
- "else": {
95
- "not": {
96
- "required": [
97
- "columns"
98
- ]
99
- }
100
- }
101
- }
102
- ]
103
- }
104
- }
105
- },
106
- "entry": {
107
- "type": "string",
108
- "minLength": 1
109
- },
110
- "schemas": {
111
- "type": "array",
112
- "minItems": 1,
113
- "items": {
114
- "type": "string",
115
- "minLength": 1
116
- }
117
- }
118
- }
119
- }
@@ -1,74 +0,0 @@
1
- use crate::LixError;
2
-
3
- pub const PLUGIN_STORAGE_ROOT_DIRECTORY_PATH: &str = "/.lix/plugins/";
4
- pub const PLUGIN_ARCHIVE_FILE_EXTENSION: &str = ".lixplugin";
5
-
6
- pub fn plugin_storage_archive_file_id(plugin_key: &str) -> String {
7
- format!("lix_plugin_archive::{plugin_key}")
8
- }
9
-
10
- pub fn plugin_storage_archive_path(plugin_key: &str) -> Result<String, LixError> {
11
- validate_plugin_key_segment(plugin_key)?;
12
- Ok(format!(
13
- "{PLUGIN_STORAGE_ROOT_DIRECTORY_PATH}{plugin_key}{PLUGIN_ARCHIVE_FILE_EXTENSION}"
14
- ))
15
- }
16
-
17
- pub fn plugin_key_from_archive_path(path: &str) -> Option<String> {
18
- let file_name = path.strip_prefix(PLUGIN_STORAGE_ROOT_DIRECTORY_PATH)?;
19
- let plugin_key = file_name.strip_suffix(PLUGIN_ARCHIVE_FILE_EXTENSION)?;
20
- if plugin_key.is_empty()
21
- || plugin_key == "."
22
- || plugin_key == ".."
23
- || plugin_key.contains('/')
24
- || plugin_key.contains('\\')
25
- {
26
- return None;
27
- }
28
- Some(plugin_key.to_string())
29
- }
30
-
31
- fn validate_plugin_key_segment(plugin_key: &str) -> Result<(), LixError> {
32
- if plugin_key.is_empty()
33
- || plugin_key == "."
34
- || plugin_key == ".."
35
- || plugin_key.contains('/')
36
- || plugin_key.contains('\\')
37
- {
38
- return Err(LixError {
39
- code: "LIX_ERROR_UNKNOWN".to_string(),
40
- message: format!(
41
- "plugin key '{}' must be a single relative path segment",
42
- plugin_key
43
- ),
44
- hint: None,
45
- details: None,
46
- });
47
- }
48
- Ok(())
49
- }
50
-
51
- #[cfg(test)]
52
- mod tests {
53
- use super::{plugin_key_from_archive_path, plugin_storage_archive_path};
54
-
55
- #[test]
56
- fn computes_storage_archive_paths() {
57
- assert_eq!(
58
- plugin_storage_archive_path("plugin_json").expect("path should build"),
59
- "/.lix/plugins/plugin_json.lixplugin"
60
- );
61
- }
62
-
63
- #[test]
64
- fn extracts_plugin_key_from_storage_path() {
65
- assert_eq!(
66
- plugin_key_from_archive_path("/.lix/plugins/plugin_json.lixplugin"),
67
- Some("plugin_json".to_string())
68
- );
69
- assert_eq!(
70
- plugin_key_from_archive_path("/.lix/plugins/nested/plugin.lixplugin"),
71
- None
72
- );
73
- }
74
- }
@@ -1,275 +0,0 @@
1
- use serde_json::{Map as JsonMap, Value as JsonValue};
2
-
3
- use crate::cel::{CelEvaluator, CelFunctionProvider};
4
- use crate::LixError;
5
-
6
- pub(crate) fn apply_schema_defaults<P>(
7
- snapshot: &mut JsonMap<String, JsonValue>,
8
- schema: &JsonValue,
9
- evaluator: &CelEvaluator,
10
- functions: P,
11
- schema_key: &str,
12
- ) -> Result<bool, LixError>
13
- where
14
- P: CelFunctionProvider,
15
- {
16
- apply_schema_defaults_with_context(
17
- snapshot,
18
- schema,
19
- &snapshot.clone(),
20
- evaluator,
21
- functions,
22
- schema_key,
23
- )
24
- }
25
-
26
- pub(crate) fn apply_schema_defaults_with_shared_runtime<P>(
27
- snapshot: &mut JsonMap<String, JsonValue>,
28
- schema: &JsonValue,
29
- functions: P,
30
- schema_key: &str,
31
- ) -> Result<bool, LixError>
32
- where
33
- P: CelFunctionProvider,
34
- {
35
- apply_schema_defaults(
36
- snapshot,
37
- schema,
38
- crate::cel::shared_runtime(),
39
- functions,
40
- schema_key,
41
- )
42
- }
43
-
44
- pub(crate) fn apply_schema_defaults_with_context<P>(
45
- snapshot: &mut JsonMap<String, JsonValue>,
46
- schema: &JsonValue,
47
- context: &JsonMap<String, JsonValue>,
48
- evaluator: &CelEvaluator,
49
- functions: P,
50
- schema_key: &str,
51
- ) -> Result<bool, LixError>
52
- where
53
- P: CelFunctionProvider,
54
- {
55
- let Some(properties) = schema.get("properties").and_then(|value| value.as_object()) else {
56
- return Ok(false);
57
- };
58
- let mut ordered_properties: Vec<(&String, &JsonValue)> = properties.iter().collect();
59
- ordered_properties.sort_by(|(left_name, _), (right_name, _)| left_name.cmp(right_name));
60
-
61
- let mut changed = false;
62
- for (field_name, field_schema) in ordered_properties {
63
- if snapshot.contains_key(field_name) {
64
- continue;
65
- }
66
-
67
- if let Some(expression) = field_schema
68
- .get("x-lix-default")
69
- .and_then(|value| value.as_str())
70
- {
71
- let value = evaluator
72
- .evaluate_with_functions(expression, context, functions.clone())
73
- .map_err(|err| LixError {
74
- code: "LIX_ERROR_UNKNOWN".to_string(),
75
- message: format!(
76
- "failed to evaluate x-lix-default for '{}.{}': {}",
77
- schema_key, field_name, err.message
78
- ),
79
- hint: None,
80
- details: None,
81
- })?;
82
- snapshot.insert(field_name.clone(), value);
83
- changed = true;
84
- continue;
85
- }
86
-
87
- if let Some(default_value) = field_schema.get("default") {
88
- snapshot.insert(field_name.clone(), default_value.clone());
89
- changed = true;
90
- }
91
- }
92
-
93
- Ok(changed)
94
- }
95
-
96
- #[cfg(test)]
97
- mod tests {
98
- use serde_json::{json, Map as JsonMap, Value as JsonValue};
99
-
100
- use crate::cel::{CelEvaluator, CelFunctionProvider};
101
-
102
- use super::apply_schema_defaults_with_context;
103
-
104
- #[test]
105
- fn applies_x_lix_default_for_missing_fields() {
106
- let evaluator = CelEvaluator::new();
107
- let schema = json!({
108
- "properties": {
109
- "slug": {
110
- "type": "string",
111
- "x-lix-default": "name + '-slug'"
112
- }
113
- }
114
- });
115
- let mut snapshot = JsonMap::new();
116
- snapshot.insert("name".to_string(), JsonValue::String("sample".to_string()));
117
- let context = snapshot.clone();
118
-
119
- let changed = apply_schema_defaults_with_context(
120
- &mut snapshot,
121
- &schema,
122
- &context,
123
- &evaluator,
124
- fixed_functions(),
125
- "test_schema",
126
- "1",
127
- )
128
- .expect("apply defaults");
129
-
130
- assert!(changed);
131
- assert_eq!(
132
- snapshot.get("slug"),
133
- Some(&JsonValue::String("sample-slug".to_string()))
134
- );
135
- }
136
-
137
- #[test]
138
- fn x_lix_default_overrides_json_default() {
139
- let evaluator = CelEvaluator::new();
140
- let schema = json!({
141
- "properties": {
142
- "status": {
143
- "type": "string",
144
- "default": "literal",
145
- "x-lix-default": "'computed'"
146
- }
147
- }
148
- });
149
- let mut snapshot = JsonMap::new();
150
- let context = snapshot.clone();
151
-
152
- let changed = apply_schema_defaults_with_context(
153
- &mut snapshot,
154
- &schema,
155
- &context,
156
- &evaluator,
157
- fixed_functions(),
158
- "test_schema",
159
- "1",
160
- )
161
- .expect("apply defaults");
162
-
163
- assert!(changed);
164
- assert_eq!(
165
- snapshot.get("status"),
166
- Some(&JsonValue::String("computed".to_string()))
167
- );
168
- }
169
-
170
- #[test]
171
- fn does_not_default_explicit_null_values() {
172
- let evaluator = CelEvaluator::new();
173
- let schema = json!({
174
- "properties": {
175
- "status": {
176
- "type": "string",
177
- "x-lix-default": "'computed'"
178
- }
179
- }
180
- });
181
- let mut snapshot = JsonMap::new();
182
- snapshot.insert("status".to_string(), JsonValue::Null);
183
- let context = snapshot.clone();
184
-
185
- let changed = apply_schema_defaults_with_context(
186
- &mut snapshot,
187
- &schema,
188
- &context,
189
- &evaluator,
190
- fixed_functions(),
191
- "test_schema",
192
- "1",
193
- )
194
- .expect("apply defaults");
195
-
196
- assert!(!changed);
197
- assert_eq!(snapshot.get("status"), Some(&JsonValue::Null));
198
- }
199
-
200
- #[test]
201
- fn applies_cel_defaults_in_stable_sorted_field_order() {
202
- #[derive(Clone)]
203
- struct CountingFunctions {
204
- next: std::sync::Arc<std::sync::atomic::AtomicI64>,
205
- }
206
-
207
- impl CelFunctionProvider for CountingFunctions {
208
- fn call_uuid_v7(&self) -> String {
209
- let current = self.next.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
210
- format!("uuid-{current}")
211
- }
212
-
213
- fn call_timestamp(&self) -> String {
214
- let current = self.next.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
215
- format!("ts-{current}")
216
- }
217
- }
218
-
219
- let evaluator = CelEvaluator::new();
220
- let schema = json!({
221
- "properties": {
222
- "z_uuid": {
223
- "type": "string",
224
- "x-lix-default": "lix_uuid_v7()"
225
- },
226
- "a_timestamp": {
227
- "type": "string",
228
- "x-lix-default": "lix_timestamp()"
229
- }
230
- }
231
- });
232
- let mut snapshot = JsonMap::new();
233
- let context = snapshot.clone();
234
-
235
- let changed = apply_schema_defaults_with_context(
236
- &mut snapshot,
237
- &schema,
238
- &context,
239
- &evaluator,
240
- CountingFunctions {
241
- next: std::sync::Arc::new(std::sync::atomic::AtomicI64::new(0)),
242
- },
243
- "test_schema",
244
- "1",
245
- )
246
- .expect("apply defaults");
247
-
248
- assert!(changed);
249
- assert_eq!(
250
- snapshot.get("a_timestamp"),
251
- Some(&JsonValue::String("ts-0".to_string()))
252
- );
253
- assert_eq!(
254
- snapshot.get("z_uuid"),
255
- Some(&JsonValue::String("uuid-1".to_string()))
256
- );
257
- }
258
-
259
- #[derive(Clone)]
260
- struct FixedFunctions;
261
-
262
- impl CelFunctionProvider for FixedFunctions {
263
- fn call_uuid_v7(&self) -> String {
264
- "uuid-fixed".to_string()
265
- }
266
-
267
- fn call_timestamp(&self) -> String {
268
- "1970-01-01T00:00:00.000Z".to_string()
269
- }
270
- }
271
-
272
- fn fixed_functions() -> FixedFunctions {
273
- FixedFunctions
274
- }
275
- }
@@ -1 +0,0 @@
1
- pub(crate) mod defaults;
@@ -1,21 +0,0 @@
1
- {
2
- "x-lix-key": "lix_account",
3
- "x-lix-primary-key": [
4
- "/id"
5
- ],
6
- "type": "object",
7
- "properties": {
8
- "id": {
9
- "type": "string",
10
- "x-lix-default": "lix_uuid_v7()"
11
- },
12
- "name": {
13
- "type": "string"
14
- }
15
- },
16
- "required": [
17
- "id",
18
- "name"
19
- ],
20
- "additionalProperties": false
21
- }
@@ -1,29 +0,0 @@
1
- {
2
- "x-lix-key": "lix_active_account",
3
- "x-lix-primary-key": [
4
- "/account_id"
5
- ],
6
- "x-lix-foreign-keys": [
7
- {
8
- "properties": [
9
- "/account_id"
10
- ],
11
- "references": {
12
- "schemaKey": "lix_account",
13
- "properties": [
14
- "/id"
15
- ]
16
- }
17
- }
18
- ],
19
- "type": "object",
20
- "properties": {
21
- "account_id": {
22
- "type": "string"
23
- }
24
- },
25
- "required": [
26
- "account_id"
27
- ],
28
- "additionalProperties": false
29
- }
@@ -1,29 +0,0 @@
1
- {
2
- "x-lix-key": "lix_binary_blob_ref",
3
- "description": "Metadata pointer from a file row to its binary payload in internal CAS storage.",
4
- "x-lix-primary-key": [
5
- "/id"
6
- ],
7
- "type": "object",
8
- "properties": {
9
- "id": {
10
- "type": "string",
11
- "description": "File primary-key value (matches lix_file.id) for this binary reference row."
12
- },
13
- "blob_hash": {
14
- "type": "string",
15
- "description": "BLAKE3 content hash used as the canonical CAS key for the binary payload."
16
- },
17
- "size_bytes": {
18
- "type": "integer",
19
- "minimum": 0,
20
- "description": "Logical uncompressed file size in bytes for the referenced binary payload."
21
- }
22
- },
23
- "required": [
24
- "id",
25
- "blob_hash",
26
- "size_bytes"
27
- ],
28
- "additionalProperties": false
29
- }
@@ -1,34 +0,0 @@
1
- {
2
- "x-lix-key": "lix_branch_descriptor",
3
- "description": "User-facing branch metadata (name and visibility). The stable identity of a branch; the matching `lix_branch_ref` carries the moving head pointer. The catalog's `lix_branch` surface joins this descriptor with its ref to present a single user-visible branch row.",
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 branch identifier (UUIDv7). Referenced by `lix_branch_ref.id`."
18
- },
19
- "name": {
20
- "type": "string",
21
- "description": "Human-readable branch name (e.g. `main`, `feature-x`) shown in branch listings and CLI output."
22
- },
23
- "hidden": {
24
- "type": "boolean",
25
- "default": false,
26
- "description": "When true, the branch is filtered from default listings (CLI, catalog views); operations by explicit id still succeed."
27
- }
28
- },
29
- "required": [
30
- "id",
31
- "name"
32
- ],
33
- "additionalProperties": false
34
- }
@@ -1,48 +0,0 @@
1
- {
2
- "x-lix-key": "lix_branch_ref",
3
- "description": "Branch head pointer. Records which commit a branch should currently resolve to in the local runtime. Intentionally not part of canonical commit membership: refs may be reset client-side after sync without introducing content conflicts. Each `lix_branch_descriptor.id` has exactly one `lix_branch_ref` row.",
4
- "x-lix-primary-key": [
5
- "/id"
6
- ],
7
- "x-lix-foreign-keys": [
8
- {
9
- "properties": [
10
- "/id"
11
- ],
12
- "references": {
13
- "schemaKey": "lix_branch_descriptor",
14
- "properties": [
15
- "/id"
16
- ]
17
- }
18
- },
19
- {
20
- "properties": [
21
- "/commit_id"
22
- ],
23
- "references": {
24
- "schemaKey": "lix_commit",
25
- "properties": [
26
- "/id"
27
- ]
28
- }
29
- }
30
- ],
31
- "type": "object",
32
- "properties": {
33
- "id": {
34
- "type": "string",
35
- "x-lix-default": "lix_uuid_v7()",
36
- "description": "Branch identifier whose head pointer is being stored; matches `lix_branch_descriptor.id`."
37
- },
38
- "commit_id": {
39
- "type": "string",
40
- "description": "Commit the branch should currently resolve to in the local runtime (references `lix_commit.id`)."
41
- }
42
- },
43
- "required": [
44
- "id",
45
- "commit_id"
46
- ],
47
- "additionalProperties": false
48
- }