@lix-js/sdk 0.6.0-preview.2 → 0.6.0-preview.4
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.
- package/SKILL.md +46 -8
- package/dist/engine-wasm/wasm/lix_engine.d.ts +25 -1
- package/dist/engine-wasm/wasm/lix_engine.js +60 -2
- package/dist/engine-wasm/wasm/lix_engine.wasm +0 -0
- package/dist/engine-wasm/wasm/lix_engine.wasm.d.ts +5 -0
- package/dist/generated/builtin-schemas.d.ts +87 -162
- package/dist/generated/builtin-schemas.js +139 -236
- package/dist/open-lix.d.ts +10 -3
- package/dist/open-lix.js +39 -0
- package/dist-engine-src/src/binary_cas/types.rs +0 -6
- package/dist-engine-src/src/catalog/context.rs +412 -0
- package/dist-engine-src/src/catalog/mod.rs +10 -0
- package/dist-engine-src/src/catalog/schema.rs +4 -0
- package/dist-engine-src/src/catalog/snapshot.rs +1114 -0
- package/dist-engine-src/src/cel/mod.rs +1 -1
- package/dist-engine-src/src/cel/provider.rs +1 -1
- package/dist-engine-src/src/commit_graph/context.rs +328 -1015
- package/dist-engine-src/src/commit_graph/mod.rs +2 -3
- package/dist-engine-src/src/commit_graph/types.rs +7 -43
- package/dist-engine-src/src/commit_graph/walker.rs +57 -81
- package/dist-engine-src/src/commit_store/codec.rs +887 -0
- package/dist-engine-src/src/commit_store/context.rs +944 -0
- package/dist-engine-src/src/commit_store/materialization.rs +84 -0
- package/dist-engine-src/src/commit_store/mod.rs +16 -0
- package/dist-engine-src/src/commit_store/storage.rs +600 -0
- package/dist-engine-src/src/commit_store/types.rs +215 -0
- package/dist-engine-src/src/common/identity.rs +15 -5
- package/dist-engine-src/src/common/json_pointer.rs +67 -0
- package/dist-engine-src/src/common/metadata.rs +17 -12
- package/dist-engine-src/src/common/mod.rs +5 -5
- package/dist-engine-src/src/domain.rs +324 -0
- package/dist-engine-src/src/engine.rs +29 -43
- package/dist-engine-src/src/entity_identity.rs +238 -118
- package/dist-engine-src/src/functions/context.rs +17 -52
- package/dist-engine-src/src/functions/deterministic.rs +1 -1
- package/dist-engine-src/src/functions/mod.rs +1 -1
- package/dist-engine-src/src/functions/provider.rs +4 -4
- package/dist-engine-src/src/functions/state.rs +39 -66
- package/dist-engine-src/src/functions/types.rs +1 -1
- package/dist-engine-src/src/init.rs +204 -151
- package/dist-engine-src/src/json_store/context.rs +354 -60
- package/dist-engine-src/src/json_store/encoded.rs +6 -6
- package/dist-engine-src/src/json_store/mod.rs +4 -1
- package/dist-engine-src/src/json_store/store.rs +884 -11
- package/dist-engine-src/src/json_store/types.rs +166 -1
- package/dist-engine-src/src/lib.rs +11 -10
- package/dist-engine-src/src/live_state/context.rs +608 -830
- package/dist-engine-src/src/live_state/mod.rs +3 -3
- package/dist-engine-src/src/live_state/overlay.rs +7 -7
- package/dist-engine-src/src/live_state/reader.rs +5 -5
- package/dist-engine-src/src/live_state/types.rs +19 -36
- package/dist-engine-src/src/live_state/visibility.rs +19 -14
- package/dist-engine-src/src/plugin/archive.rs +3 -6
- package/dist-engine-src/src/plugin/install.rs +0 -18
- package/dist-engine-src/src/plugin/plugin_manifest.json +0 -1
- package/dist-engine-src/src/schema/annotations/defaults.rs +2 -7
- package/dist-engine-src/src/schema/builtin/lix_account.json +0 -1
- package/dist-engine-src/src/schema/builtin/lix_active_account.json +0 -1
- package/dist-engine-src/src/schema/builtin/lix_binary_blob_ref.json +0 -1
- package/dist-engine-src/src/schema/builtin/lix_change.json +11 -10
- package/dist-engine-src/src/schema/builtin/lix_change_author.json +0 -1
- package/dist-engine-src/src/schema/builtin/lix_commit.json +8 -46
- package/dist-engine-src/src/schema/builtin/lix_commit_edge.json +29 -22
- package/dist-engine-src/src/schema/builtin/lix_directory_descriptor.json +0 -1
- package/dist-engine-src/src/schema/builtin/lix_file_descriptor.json +0 -1
- package/dist-engine-src/src/schema/builtin/lix_key_value.json +0 -1
- package/dist-engine-src/src/schema/builtin/lix_label.json +10 -3
- package/dist-engine-src/src/schema/builtin/lix_label_assignment.json +74 -0
- package/dist-engine-src/src/schema/builtin/lix_registered_schema.json +2 -8
- package/dist-engine-src/src/schema/builtin/lix_version_descriptor.json +0 -1
- package/dist-engine-src/src/schema/builtin/lix_version_ref.json +0 -1
- package/dist-engine-src/src/schema/builtin/mod.rs +10 -59
- package/dist-engine-src/src/schema/compatibility.rs +787 -0
- package/dist-engine-src/src/schema/definition.json +47 -17
- package/dist-engine-src/src/schema/definition.rs +202 -96
- package/dist-engine-src/src/schema/key.rs +9 -77
- package/dist-engine-src/src/schema/mod.rs +4 -4
- package/dist-engine-src/src/schema/tests.rs +133 -92
- package/dist-engine-src/src/session/context.rs +86 -48
- package/dist-engine-src/src/session/create_version.rs +22 -14
- package/dist-engine-src/src/session/execute.rs +117 -23
- package/dist-engine-src/src/session/merge/apply.rs +4 -4
- package/dist-engine-src/src/session/merge/conflicts.rs +3 -2
- package/dist-engine-src/src/session/merge/stats.rs +1 -1
- package/dist-engine-src/src/session/merge/version.rs +35 -45
- package/dist-engine-src/src/session/mod.rs +9 -7
- package/dist-engine-src/src/session/optimization9_sql2_bench.rs +100 -0
- package/dist-engine-src/src/session/switch_version.rs +17 -28
- package/dist-engine-src/src/session/transaction.rs +76 -0
- package/dist-engine-src/src/sql2/change_provider.rs +14 -20
- package/dist-engine-src/src/sql2/classify.rs +75 -48
- package/dist-engine-src/src/sql2/context.rs +22 -18
- package/dist-engine-src/src/sql2/directory_history_provider.rs +28 -20
- package/dist-engine-src/src/sql2/directory_provider.rs +131 -83
- package/dist-engine-src/src/sql2/entity_history_provider.rs +10 -14
- package/dist-engine-src/src/sql2/entity_provider.rs +680 -169
- package/dist-engine-src/src/sql2/error.rs +24 -5
- package/dist-engine-src/src/sql2/execute.rs +426 -272
- package/dist-engine-src/src/sql2/file_history_provider.rs +29 -21
- package/dist-engine-src/src/sql2/file_provider.rs +533 -108
- package/dist-engine-src/src/sql2/filesystem_planner.rs +58 -94
- package/dist-engine-src/src/sql2/filesystem_visibility.rs +37 -23
- package/dist-engine-src/src/sql2/history_projection.rs +3 -27
- package/dist-engine-src/src/sql2/history_provider.rs +11 -17
- package/dist-engine-src/src/sql2/history_route.rs +22 -8
- package/dist-engine-src/src/sql2/lix_state_provider.rs +178 -96
- package/dist-engine-src/src/sql2/mod.rs +8 -4
- package/dist-engine-src/src/sql2/predicate_typecheck.rs +246 -0
- package/dist-engine-src/src/sql2/public_bind/assignment.rs +46 -0
- package/dist-engine-src/src/sql2/public_bind/capability.rs +41 -0
- package/dist-engine-src/src/sql2/public_bind/dml.rs +172 -0
- package/dist-engine-src/src/sql2/public_bind/mod.rs +26 -0
- package/dist-engine-src/src/sql2/public_bind/table.rs +168 -0
- package/dist-engine-src/src/sql2/read_only.rs +10 -12
- package/dist-engine-src/src/sql2/session.rs +7 -10
- package/dist-engine-src/src/sql2/udfs/lix_timestamp.rs +76 -0
- package/dist-engine-src/src/sql2/udfs/mod.rs +8 -1
- package/dist-engine-src/src/sql2/udfs/public_call.rs +238 -0
- package/dist-engine-src/src/sql2/version_provider.rs +46 -31
- package/dist-engine-src/src/sql2/version_scope.rs +4 -4
- package/dist-engine-src/src/storage_bench.rs +1782 -325
- package/dist-engine-src/src/test_support.rs +183 -36
- package/dist-engine-src/src/tracked_state/by_file_index.rs +20 -24
- package/dist-engine-src/src/tracked_state/codec.rs +1519 -181
- package/dist-engine-src/src/tracked_state/context.rs +1155 -271
- package/dist-engine-src/src/tracked_state/diff.rs +249 -57
- package/dist-engine-src/src/tracked_state/materialization.rs +365 -103
- package/dist-engine-src/src/tracked_state/materializer.rs +488 -0
- package/dist-engine-src/src/tracked_state/merge.rs +37 -19
- package/dist-engine-src/src/tracked_state/mod.rs +8 -7
- package/dist-engine-src/src/tracked_state/storage.rs +138 -6
- package/dist-engine-src/src/tracked_state/tree.rs +695 -252
- package/dist-engine-src/src/tracked_state/types.rs +176 -6
- package/dist-engine-src/src/transaction/commit.rs +695 -435
- package/dist-engine-src/src/transaction/context.rs +551 -310
- package/dist-engine-src/src/transaction/live_state_overlay.rs +9 -8
- package/dist-engine-src/src/transaction/mod.rs +2 -0
- package/dist-engine-src/src/transaction/normalization.rs +311 -447
- package/dist-engine-src/src/transaction/prep.rs +37 -0
- package/dist-engine-src/src/transaction/schema_resolver.rs +93 -71
- package/dist-engine-src/src/transaction/staging.rs +701 -406
- package/dist-engine-src/src/transaction/types.rs +231 -122
- package/dist-engine-src/src/transaction/validation.rs +2717 -1698
- package/dist-engine-src/src/untracked_state/codec.rs +40 -96
- package/dist-engine-src/src/untracked_state/context.rs +21 -5
- package/dist-engine-src/src/untracked_state/materialization.rs +10 -104
- package/dist-engine-src/src/untracked_state/mod.rs +3 -5
- package/dist-engine-src/src/untracked_state/storage.rs +105 -57
- package/dist-engine-src/src/untracked_state/types.rs +63 -13
- package/dist-engine-src/src/version/context.rs +1 -13
- package/dist-engine-src/src/version/lifecycle.rs +221 -0
- package/dist-engine-src/src/version/mod.rs +3 -2
- package/dist-engine-src/src/version/refs.rs +12 -103
- package/dist-engine-src/src/version/stage_rows.rs +15 -19
- package/package.json +1 -1
- package/dist-engine-src/src/changelog/codec.rs +0 -321
- package/dist-engine-src/src/changelog/context.rs +0 -92
- package/dist-engine-src/src/changelog/materialization.rs +0 -121
- package/dist-engine-src/src/changelog/mod.rs +0 -13
- package/dist-engine-src/src/changelog/reader.rs +0 -20
- package/dist-engine-src/src/changelog/storage.rs +0 -220
- package/dist-engine-src/src/changelog/types.rs +0 -38
- package/dist-engine-src/src/schema/builtin/lix_change_set.json +0 -18
- package/dist-engine-src/src/schema/builtin/lix_change_set_element.json +0 -75
- package/dist-engine-src/src/schema/builtin/lix_entity_label.json +0 -63
- package/dist-engine-src/src/schema_registry.rs +0 -294
- package/dist-engine-src/src/sql2/commit_derived_provider.rs +0 -591
- package/dist-engine-src/src/tracked_state/rebuild.rs +0 -771
- package/dist-engine-src/src/tracked_state/tree_types.rs +0 -176
|
@@ -1,46 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"x-lix-key": "lix_commit_edge",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
}
|
|
7
15
|
],
|
|
16
|
+
"x-lix-primary-key": ["/child_id", "/parent_order"],
|
|
17
|
+
"x-lix-unique": [["/parent_id", "/child_id"]],
|
|
8
18
|
"x-lix-foreign-keys": [
|
|
9
19
|
{
|
|
10
|
-
"properties": [
|
|
11
|
-
"/parent_id"
|
|
12
|
-
],
|
|
20
|
+
"properties": ["/parent_id"],
|
|
13
21
|
"references": {
|
|
14
22
|
"schemaKey": "lix_commit",
|
|
15
|
-
"properties": [
|
|
16
|
-
"/id"
|
|
17
|
-
]
|
|
23
|
+
"properties": ["/id"]
|
|
18
24
|
}
|
|
19
25
|
},
|
|
20
26
|
{
|
|
21
|
-
"properties": [
|
|
22
|
-
"/child_id"
|
|
23
|
-
],
|
|
27
|
+
"properties": ["/child_id"],
|
|
24
28
|
"references": {
|
|
25
29
|
"schemaKey": "lix_commit",
|
|
26
|
-
"properties": [
|
|
27
|
-
"/id"
|
|
28
|
-
]
|
|
30
|
+
"properties": ["/id"]
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
],
|
|
32
34
|
"type": "object",
|
|
33
35
|
"properties": {
|
|
34
36
|
"parent_id": {
|
|
35
|
-
"type": "string"
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "Identifier of the parent commit."
|
|
36
39
|
},
|
|
37
40
|
"child_id": {
|
|
38
|
-
"type": "string"
|
|
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."
|
|
39
49
|
}
|
|
40
50
|
},
|
|
41
|
-
"required": [
|
|
42
|
-
"parent_id",
|
|
43
|
-
"child_id"
|
|
44
|
-
],
|
|
51
|
+
"required": ["parent_id", "child_id", "parent_order"],
|
|
45
52
|
"additionalProperties": false
|
|
46
53
|
}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"x-lix-key": "lix_label",
|
|
3
|
-
"
|
|
3
|
+
"description": "Catalog of labels that can be assigned to arbitrary live Lix rows through lix_label_assignment.",
|
|
4
4
|
"x-lix-primary-key": [
|
|
5
5
|
"/id"
|
|
6
6
|
],
|
|
7
|
+
"x-lix-unique": [
|
|
8
|
+
[
|
|
9
|
+
"/name"
|
|
10
|
+
]
|
|
11
|
+
],
|
|
7
12
|
"type": "object",
|
|
8
13
|
"properties": {
|
|
9
14
|
"id": {
|
|
10
15
|
"type": "string",
|
|
11
|
-
"x-lix-default": "lix_uuid_v7()"
|
|
16
|
+
"x-lix-default": "lix_uuid_v7()",
|
|
17
|
+
"description": "Stable label identifier. Label assignments reference this value."
|
|
12
18
|
},
|
|
13
19
|
"name": {
|
|
14
|
-
"type": "string"
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Human-readable label name. Unique across labels."
|
|
15
22
|
}
|
|
16
23
|
},
|
|
17
24
|
"required": [
|
|
@@ -0,0 +1,74 @@
|
|
|
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_id, target_schema_key, target_file_id). The state foreign-key tuple is ordered as [0] target_entity_id, [1] target_schema_key, [2] target_file_id.",
|
|
4
|
+
"x-lix-primary-key": [
|
|
5
|
+
"/id"
|
|
6
|
+
],
|
|
7
|
+
"x-lix-unique": [
|
|
8
|
+
[
|
|
9
|
+
"/target_entity_id",
|
|
10
|
+
"/target_schema_key",
|
|
11
|
+
"/target_file_id",
|
|
12
|
+
"/label_id"
|
|
13
|
+
]
|
|
14
|
+
],
|
|
15
|
+
"x-lix-state-foreign-keys": [
|
|
16
|
+
[
|
|
17
|
+
"/target_entity_id",
|
|
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_id": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"description": "Target row entity_id. 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_id",
|
|
69
|
+
"target_schema_key",
|
|
70
|
+
"target_file_id",
|
|
71
|
+
"label_id"
|
|
72
|
+
],
|
|
73
|
+
"additionalProperties": false
|
|
74
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"x-lix-key": "lix_registered_schema",
|
|
3
|
-
"x-lix-version": "1",
|
|
4
3
|
"x-lix-primary-key": [
|
|
5
|
-
"/value/x-lix-key"
|
|
6
|
-
"/value/x-lix-version"
|
|
4
|
+
"/value/x-lix-key"
|
|
7
5
|
],
|
|
8
6
|
"type": "object",
|
|
9
7
|
"properties": {
|
|
@@ -12,14 +10,10 @@
|
|
|
12
10
|
"properties": {
|
|
13
11
|
"x-lix-key": {
|
|
14
12
|
"type": "string"
|
|
15
|
-
},
|
|
16
|
-
"x-lix-version": {
|
|
17
|
-
"type": "string"
|
|
18
13
|
}
|
|
19
14
|
},
|
|
20
15
|
"required": [
|
|
21
|
-
"x-lix-key"
|
|
22
|
-
"x-lix-version"
|
|
16
|
+
"x-lix-key"
|
|
23
17
|
],
|
|
24
18
|
"additionalProperties": true
|
|
25
19
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"x-lix-key": "lix_version_descriptor",
|
|
3
|
-
"x-lix-version": "1",
|
|
4
3
|
"description": "User-facing version metadata (name and visibility) for a branch-like version. The stable identity of a version; the matching `lix_version_ref` carries the moving head pointer. The catalog's `lix_version` surface joins this descriptor with its ref to present a single user-visible version row.",
|
|
5
4
|
"x-lix-primary-key": [
|
|
6
5
|
"/id"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"x-lix-key": "lix_version_ref",
|
|
3
|
-
"x-lix-version": "1",
|
|
4
3
|
"description": "Version head pointer. Records which commit a version 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_version_descriptor.id` has exactly one `lix_version_ref` row.",
|
|
5
4
|
"x-lix-primary-key": [
|
|
6
5
|
"/id"
|
|
@@ -8,33 +8,28 @@ const LIX_KEY_VALUE_SCHEMA_KEY: &str = "lix_key_value";
|
|
|
8
8
|
const LIX_ACCOUNT_SCHEMA_KEY: &str = "lix_account";
|
|
9
9
|
const LIX_ACTIVE_ACCOUNT_SCHEMA_KEY: &str = "lix_active_account";
|
|
10
10
|
const LIX_LABEL_SCHEMA_KEY: &str = "lix_label";
|
|
11
|
-
const
|
|
11
|
+
const LIX_LABEL_ASSIGNMENT_SCHEMA_KEY: &str = "lix_label_assignment";
|
|
12
12
|
const LIX_CHANGE_SCHEMA_KEY: &str = "lix_change";
|
|
13
13
|
const LIX_CHANGE_AUTHOR_SCHEMA_KEY: &str = "lix_change_author";
|
|
14
|
-
const LIX_CHANGE_SET_SCHEMA_KEY: &str = "lix_change_set";
|
|
15
14
|
const LIX_COMMIT_SCHEMA_KEY: &str = "lix_commit";
|
|
16
15
|
const LIX_VERSION_DESCRIPTOR_SCHEMA_KEY: &str = "lix_version_descriptor";
|
|
17
16
|
const LIX_VERSION_REF_SCHEMA_KEY: &str = "lix_version_ref";
|
|
18
|
-
const LIX_CHANGE_SET_ELEMENT_SCHEMA_KEY: &str = "lix_change_set_element";
|
|
19
17
|
const LIX_COMMIT_EDGE_SCHEMA_KEY: &str = "lix_commit_edge";
|
|
20
18
|
const LIX_FILE_DESCRIPTOR_SCHEMA_KEY: &str = "lix_file_descriptor";
|
|
21
19
|
const LIX_DIRECTORY_DESCRIPTOR_SCHEMA_KEY: &str = "lix_directory_descriptor";
|
|
22
20
|
const LIX_BINARY_BLOB_REF_SCHEMA_KEY: &str = "lix_binary_blob_ref";
|
|
23
|
-
const LIX_STATE_SURFACE_SCHEMA_KEY: &str = "lix_state";
|
|
24
21
|
|
|
25
22
|
const LIX_REGISTERED_SCHEMA_JSON: &str = include_str!("lix_registered_schema.json");
|
|
26
23
|
const LIX_KEY_VALUE_SCHEMA_JSON: &str = include_str!("lix_key_value.json");
|
|
27
24
|
const LIX_ACCOUNT_SCHEMA_JSON: &str = include_str!("lix_account.json");
|
|
28
25
|
const LIX_ACTIVE_ACCOUNT_SCHEMA_JSON: &str = include_str!("lix_active_account.json");
|
|
29
26
|
const LIX_LABEL_SCHEMA_JSON: &str = include_str!("lix_label.json");
|
|
30
|
-
const
|
|
27
|
+
const LIX_LABEL_ASSIGNMENT_SCHEMA_JSON: &str = include_str!("lix_label_assignment.json");
|
|
31
28
|
const LIX_CHANGE_SCHEMA_JSON: &str = include_str!("lix_change.json");
|
|
32
29
|
const LIX_CHANGE_AUTHOR_SCHEMA_JSON: &str = include_str!("lix_change_author.json");
|
|
33
|
-
const LIX_CHANGE_SET_SCHEMA_JSON: &str = include_str!("lix_change_set.json");
|
|
34
30
|
const LIX_COMMIT_SCHEMA_JSON: &str = include_str!("lix_commit.json");
|
|
35
31
|
const LIX_VERSION_DESCRIPTOR_SCHEMA_JSON: &str = include_str!("lix_version_descriptor.json");
|
|
36
32
|
const LIX_VERSION_REF_SCHEMA_JSON: &str = include_str!("lix_version_ref.json");
|
|
37
|
-
const LIX_CHANGE_SET_ELEMENT_SCHEMA_JSON: &str = include_str!("lix_change_set_element.json");
|
|
38
33
|
const LIX_COMMIT_EDGE_SCHEMA_JSON: &str = include_str!("lix_commit_edge.json");
|
|
39
34
|
const LIX_FILE_DESCRIPTOR_SCHEMA_JSON: &str = include_str!("lix_file_descriptor.json");
|
|
40
35
|
const LIX_DIRECTORY_DESCRIPTOR_SCHEMA_JSON: &str = include_str!("lix_directory_descriptor.json");
|
|
@@ -45,19 +40,16 @@ static LIX_KEY_VALUE_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
|
45
40
|
static LIX_ACCOUNT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
46
41
|
static LIX_ACTIVE_ACCOUNT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
47
42
|
static LIX_LABEL_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
48
|
-
static
|
|
43
|
+
static LIX_LABEL_ASSIGNMENT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
49
44
|
static LIX_CHANGE_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
50
45
|
static LIX_CHANGE_AUTHOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
51
|
-
static LIX_CHANGE_SET_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
52
46
|
static LIX_COMMIT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
53
47
|
static LIX_VERSION_DESCRIPTOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
54
48
|
static LIX_VERSION_REF_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
55
|
-
static LIX_CHANGE_SET_ELEMENT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
56
49
|
static LIX_COMMIT_EDGE_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
57
50
|
static LIX_FILE_DESCRIPTOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
58
51
|
static LIX_DIRECTORY_DESCRIPTOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
59
52
|
static LIX_BINARY_BLOB_REF_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
60
|
-
static LIX_STATE_SURFACE_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
61
53
|
|
|
62
54
|
const BUILTIN_SCHEMA_KEYS: &[&str] = &[
|
|
63
55
|
LIX_REGISTERED_SCHEMA_KEY,
|
|
@@ -65,14 +57,12 @@ const BUILTIN_SCHEMA_KEYS: &[&str] = &[
|
|
|
65
57
|
LIX_ACCOUNT_SCHEMA_KEY,
|
|
66
58
|
LIX_ACTIVE_ACCOUNT_SCHEMA_KEY,
|
|
67
59
|
LIX_LABEL_SCHEMA_KEY,
|
|
68
|
-
|
|
60
|
+
LIX_LABEL_ASSIGNMENT_SCHEMA_KEY,
|
|
69
61
|
LIX_CHANGE_SCHEMA_KEY,
|
|
70
62
|
LIX_CHANGE_AUTHOR_SCHEMA_KEY,
|
|
71
|
-
LIX_CHANGE_SET_SCHEMA_KEY,
|
|
72
63
|
LIX_COMMIT_SCHEMA_KEY,
|
|
73
64
|
LIX_VERSION_DESCRIPTOR_SCHEMA_KEY,
|
|
74
65
|
LIX_VERSION_REF_SCHEMA_KEY,
|
|
75
|
-
LIX_CHANGE_SET_ELEMENT_SCHEMA_KEY,
|
|
76
66
|
LIX_COMMIT_EDGE_SCHEMA_KEY,
|
|
77
67
|
LIX_FILE_DESCRIPTOR_SCHEMA_KEY,
|
|
78
68
|
LIX_DIRECTORY_DESCRIPTOR_SCHEMA_KEY,
|
|
@@ -93,35 +83,6 @@ pub(super) fn seed_schema_definitions() -> Vec<&'static JsonValue> {
|
|
|
93
83
|
.collect()
|
|
94
84
|
}
|
|
95
85
|
|
|
96
|
-
// `lix_state` is a public SQL surface, not a stored builtin schema row, but
|
|
97
|
-
// multiple owners still need a schema-shaped contract for validation and SQL
|
|
98
|
-
// preparation. Keep that shared shape here so those callers do not drift.
|
|
99
|
-
pub(crate) fn lix_state_surface_schema_definition() -> &'static JsonValue {
|
|
100
|
-
LIX_STATE_SURFACE_SCHEMA.get_or_init(|| {
|
|
101
|
-
serde_json::json!({
|
|
102
|
-
"x-lix-key": LIX_STATE_SURFACE_SCHEMA_KEY,
|
|
103
|
-
"x-lix-version": "1",
|
|
104
|
-
"x-lix-primary-key": [
|
|
105
|
-
"/entity_id",
|
|
106
|
-
"/schema_key",
|
|
107
|
-
"/file_id"
|
|
108
|
-
],
|
|
109
|
-
"type": "object",
|
|
110
|
-
"properties": {
|
|
111
|
-
"entity_id": { "type": "string" },
|
|
112
|
-
"schema_key": { "type": "string" },
|
|
113
|
-
"file_id": { "type": "string" }
|
|
114
|
-
},
|
|
115
|
-
"required": [
|
|
116
|
-
"entity_id",
|
|
117
|
-
"schema_key",
|
|
118
|
-
"file_id"
|
|
119
|
-
],
|
|
120
|
-
"additionalProperties": true
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
}
|
|
124
|
-
|
|
125
86
|
pub(super) fn seed_schema_definition(schema_key: &str) -> Option<&'static JsonValue> {
|
|
126
87
|
match schema_key {
|
|
127
88
|
LIX_REGISTERED_SCHEMA_KEY => Some(
|
|
@@ -143,8 +104,11 @@ pub(super) fn seed_schema_definition(schema_key: &str) -> Option<&'static JsonVa
|
|
|
143
104
|
LIX_LABEL_SCHEMA
|
|
144
105
|
.get_or_init(|| parse_builtin_schema("lix_label.json", LIX_LABEL_SCHEMA_JSON)),
|
|
145
106
|
),
|
|
146
|
-
|
|
147
|
-
parse_builtin_schema(
|
|
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
|
+
)
|
|
148
112
|
})),
|
|
149
113
|
LIX_CHANGE_SCHEMA_KEY => Some(
|
|
150
114
|
LIX_CHANGE_SCHEMA
|
|
@@ -153,9 +117,6 @@ pub(super) fn seed_schema_definition(schema_key: &str) -> Option<&'static JsonVa
|
|
|
153
117
|
LIX_CHANGE_AUTHOR_SCHEMA_KEY => Some(LIX_CHANGE_AUTHOR_SCHEMA.get_or_init(|| {
|
|
154
118
|
parse_builtin_schema("lix_change_author.json", LIX_CHANGE_AUTHOR_SCHEMA_JSON)
|
|
155
119
|
})),
|
|
156
|
-
LIX_CHANGE_SET_SCHEMA_KEY => Some(LIX_CHANGE_SET_SCHEMA.get_or_init(|| {
|
|
157
|
-
parse_builtin_schema("lix_change_set.json", LIX_CHANGE_SET_SCHEMA_JSON)
|
|
158
|
-
})),
|
|
159
120
|
LIX_COMMIT_SCHEMA_KEY => Some(
|
|
160
121
|
LIX_COMMIT_SCHEMA
|
|
161
122
|
.get_or_init(|| parse_builtin_schema("lix_commit.json", LIX_COMMIT_SCHEMA_JSON)),
|
|
@@ -171,14 +132,6 @@ pub(super) fn seed_schema_definition(schema_key: &str) -> Option<&'static JsonVa
|
|
|
171
132
|
LIX_VERSION_REF_SCHEMA_KEY => Some(LIX_VERSION_REF_SCHEMA.get_or_init(|| {
|
|
172
133
|
parse_builtin_schema("lix_version_ref.json", LIX_VERSION_REF_SCHEMA_JSON)
|
|
173
134
|
})),
|
|
174
|
-
LIX_CHANGE_SET_ELEMENT_SCHEMA_KEY => {
|
|
175
|
-
Some(LIX_CHANGE_SET_ELEMENT_SCHEMA.get_or_init(|| {
|
|
176
|
-
parse_builtin_schema(
|
|
177
|
-
"lix_change_set_element.json",
|
|
178
|
-
LIX_CHANGE_SET_ELEMENT_SCHEMA_JSON,
|
|
179
|
-
)
|
|
180
|
-
}))
|
|
181
|
-
}
|
|
182
135
|
LIX_COMMIT_EDGE_SCHEMA_KEY => Some(LIX_COMMIT_EDGE_SCHEMA.get_or_init(|| {
|
|
183
136
|
parse_builtin_schema("lix_commit_edge.json", LIX_COMMIT_EDGE_SCHEMA_JSON)
|
|
184
137
|
})),
|
|
@@ -208,14 +161,12 @@ pub(crate) fn builtin_schema_json(schema_key: &str) -> Option<&'static str> {
|
|
|
208
161
|
LIX_ACCOUNT_SCHEMA_KEY => Some(LIX_ACCOUNT_SCHEMA_JSON),
|
|
209
162
|
LIX_ACTIVE_ACCOUNT_SCHEMA_KEY => Some(LIX_ACTIVE_ACCOUNT_SCHEMA_JSON),
|
|
210
163
|
LIX_LABEL_SCHEMA_KEY => Some(LIX_LABEL_SCHEMA_JSON),
|
|
211
|
-
|
|
164
|
+
LIX_LABEL_ASSIGNMENT_SCHEMA_KEY => Some(LIX_LABEL_ASSIGNMENT_SCHEMA_JSON),
|
|
212
165
|
LIX_CHANGE_SCHEMA_KEY => Some(LIX_CHANGE_SCHEMA_JSON),
|
|
213
166
|
LIX_CHANGE_AUTHOR_SCHEMA_KEY => Some(LIX_CHANGE_AUTHOR_SCHEMA_JSON),
|
|
214
|
-
LIX_CHANGE_SET_SCHEMA_KEY => Some(LIX_CHANGE_SET_SCHEMA_JSON),
|
|
215
167
|
LIX_COMMIT_SCHEMA_KEY => Some(LIX_COMMIT_SCHEMA_JSON),
|
|
216
168
|
LIX_VERSION_DESCRIPTOR_SCHEMA_KEY => Some(LIX_VERSION_DESCRIPTOR_SCHEMA_JSON),
|
|
217
169
|
LIX_VERSION_REF_SCHEMA_KEY => Some(LIX_VERSION_REF_SCHEMA_JSON),
|
|
218
|
-
LIX_CHANGE_SET_ELEMENT_SCHEMA_KEY => Some(LIX_CHANGE_SET_ELEMENT_SCHEMA_JSON),
|
|
219
170
|
LIX_COMMIT_EDGE_SCHEMA_KEY => Some(LIX_COMMIT_EDGE_SCHEMA_JSON),
|
|
220
171
|
LIX_FILE_DESCRIPTOR_SCHEMA_KEY => Some(LIX_FILE_DESCRIPTOR_SCHEMA_JSON),
|
|
221
172
|
LIX_DIRECTORY_DESCRIPTOR_SCHEMA_KEY => Some(LIX_DIRECTORY_DESCRIPTOR_SCHEMA_JSON),
|