@lix-js/sdk 0.6.0-preview.4 → 0.6.0-preview.5
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/README.md +1 -1
- package/SKILL.md +65 -64
- package/dist/engine-wasm/index.js +4 -4
- package/dist/engine-wasm/wasm/lix_engine.d.ts +5 -5
- package/dist/engine-wasm/wasm/lix_engine.js +130 -118
- package/dist/engine-wasm/wasm/lix_engine.wasm +0 -0
- package/dist/engine-wasm/wasm/lix_engine.wasm.d.ts +9 -8
- package/dist/generated/builtin-schemas.d.ts +69 -69
- package/dist/generated/builtin-schemas.js +94 -94
- package/dist/open-lix.d.ts +33 -26
- package/dist/open-lix.js +10 -10
- package/dist/sqlite/index.js +86 -30
- package/dist-engine-src/README.md +3 -3
- package/dist-engine-src/src/backend/capabilities.rs +67 -0
- package/dist-engine-src/src/backend/conformance/baseline.rs +1127 -0
- package/dist-engine-src/src/backend/conformance/factory.rs +93 -0
- package/dist-engine-src/src/backend/conformance/failure_tests.rs +608 -0
- package/dist-engine-src/src/backend/conformance/fixtures.rs +26 -0
- package/dist-engine-src/src/backend/conformance/mod.rs +75 -0
- package/dist-engine-src/src/backend/conformance/model.rs +28 -0
- package/dist-engine-src/src/backend/conformance/model_based.rs +257 -0
- package/dist-engine-src/src/backend/conformance/persistence.rs +204 -0
- package/dist-engine-src/src/backend/conformance/projection.rs +21 -0
- package/dist-engine-src/src/backend/conformance/pushdown.rs +24 -0
- package/dist-engine-src/src/backend/conformance/runner.rs +90 -0
- package/dist-engine-src/src/backend/conformance/scan.rs +24 -0
- package/dist-engine-src/src/backend/conformance/write.rs +16 -0
- package/dist-engine-src/src/backend/error.rs +94 -0
- package/dist-engine-src/src/backend/in_memory.rs +670 -0
- package/dist-engine-src/src/backend/mod.rs +36 -9
- package/dist-engine-src/src/backend/predicate.rs +80 -0
- package/dist-engine-src/src/backend/traits.rs +260 -0
- package/dist-engine-src/src/backend/types.rs +224 -81
- package/dist-engine-src/src/binary_cas/context.rs +8 -8
- package/dist-engine-src/src/binary_cas/kv.rs +234 -259
- package/dist-engine-src/src/{version → branch}/context.rs +12 -12
- package/dist-engine-src/src/branch/lifecycle.rs +221 -0
- package/dist-engine-src/src/branch/mod.rs +13 -0
- package/dist-engine-src/src/branch/refs.rs +321 -0
- package/dist-engine-src/src/branch/stage_rows.rs +67 -0
- package/dist-engine-src/src/branch/types.rs +21 -0
- package/dist-engine-src/src/catalog/context.rs +18 -18
- package/dist-engine-src/src/catalog/snapshot.rs +8 -8
- package/dist-engine-src/src/changelog/bench_support.rs +785 -0
- package/dist-engine-src/src/changelog/change.rs +1 -0
- package/dist-engine-src/src/changelog/codec.rs +497 -0
- package/dist-engine-src/src/changelog/commit.rs +1 -0
- package/dist-engine-src/src/changelog/context.rs +1614 -0
- package/dist-engine-src/src/changelog/mod.rs +29 -0
- package/dist-engine-src/src/changelog/store.rs +163 -0
- package/dist-engine-src/src/changelog/test_support.rs +54 -0
- package/dist-engine-src/src/changelog/types.rs +213 -0
- package/dist-engine-src/src/commit_graph/context.rs +317 -274
- package/dist-engine-src/src/commit_graph/mod.rs +2 -4
- package/dist-engine-src/src/commit_graph/types.rs +22 -42
- package/dist-engine-src/src/commit_graph/walker.rs +133 -103
- package/dist-engine-src/src/common/error.rs +52 -18
- package/dist-engine-src/src/common/identity.rs +2 -2
- package/dist-engine-src/src/common/mod.rs +1 -1
- package/dist-engine-src/src/domain.rs +42 -46
- package/dist-engine-src/src/engine.rs +74 -96
- package/dist-engine-src/src/{entity_identity.rs → entity_pk.rs} +89 -92
- package/dist-engine-src/src/functions/context.rs +56 -52
- package/dist-engine-src/src/functions/state.rs +51 -52
- package/dist-engine-src/src/init.rs +288 -154
- package/dist-engine-src/src/json_store/context.rs +15 -266
- package/dist-engine-src/src/json_store/mod.rs +26 -0
- package/dist-engine-src/src/json_store/store.rs +103 -718
- package/dist-engine-src/src/json_store/types.rs +4 -9
- package/dist-engine-src/src/lib.rs +49 -19
- package/dist-engine-src/src/live_state/context.rs +654 -790
- package/dist-engine-src/src/live_state/mod.rs +9 -3
- package/dist-engine-src/src/live_state/overlay.rs +4 -4
- package/dist-engine-src/src/live_state/types.rs +30 -21
- package/dist-engine-src/src/live_state/visibility.rs +514 -71
- package/dist-engine-src/src/plugin/install.rs +48 -48
- package/dist-engine-src/src/plugin/manifest.rs +7 -7
- package/dist-engine-src/src/plugin/materializer.rs +0 -275
- package/dist-engine-src/src/plugin/plugin_manifest.json +4 -3
- package/dist-engine-src/src/schema/builtin/lix_binary_blob_ref.json +2 -2
- package/dist-engine-src/src/schema/builtin/lix_branch_descriptor.json +34 -0
- package/dist-engine-src/src/schema/builtin/lix_branch_ref.json +48 -0
- package/dist-engine-src/src/schema/builtin/lix_change.json +3 -3
- package/dist-engine-src/src/schema/builtin/lix_commit.json +1 -1
- package/dist-engine-src/src/schema/builtin/lix_label_assignment.json +6 -6
- package/dist-engine-src/src/schema/builtin/mod.rs +18 -20
- package/dist-engine-src/src/schema/compatibility.rs +11 -11
- package/dist-engine-src/src/schema/definition.json +2 -2
- package/dist-engine-src/src/schema/definition.rs +5 -5
- package/dist-engine-src/src/schema/key.rs +3 -3
- package/dist-engine-src/src/schema/mod.rs +1 -1
- package/dist-engine-src/src/schema/tests.rs +18 -18
- package/dist-engine-src/src/session/context.rs +803 -148
- package/dist-engine-src/src/session/create_branch.rs +94 -0
- package/dist-engine-src/src/session/execute.rs +223 -83
- package/dist-engine-src/src/session/merge/analysis.rs +9 -3
- package/dist-engine-src/src/session/merge/{version.rs → branch.rs} +119 -129
- package/dist-engine-src/src/session/merge/conflicts.rs +2 -2
- package/dist-engine-src/src/session/merge/mod.rs +5 -6
- package/dist-engine-src/src/session/merge/stats.rs +7 -11
- package/dist-engine-src/src/session/mod.rs +15 -12
- package/dist-engine-src/src/session/switch_branch.rs +113 -0
- package/dist-engine-src/src/session/transaction.rs +495 -14
- package/dist-engine-src/src/sql2/{classify.rs → bind/classify.rs} +3 -75
- package/dist-engine-src/src/sql2/bind/error.rs +5 -0
- package/dist-engine-src/src/sql2/bind/expr.rs +29 -0
- package/dist-engine-src/src/sql2/bind/mod.rs +12 -0
- package/dist-engine-src/src/sql2/{udfs/public_call.rs → bind/public_udf.rs} +71 -3
- package/dist-engine-src/src/sql2/bind/read.rs +65 -0
- package/dist-engine-src/src/sql2/bind/statement.rs +2236 -0
- package/dist-engine-src/src/sql2/bind/table.rs +273 -0
- package/dist-engine-src/src/sql2/bind/write.rs +86 -0
- package/dist-engine-src/src/sql2/branch_scope.rs +436 -0
- package/dist-engine-src/src/sql2/catalog/capability.rs +20 -0
- package/dist-engine-src/src/sql2/catalog/entity_surface.rs +296 -0
- package/dist-engine-src/src/sql2/catalog/mod.rs +15 -0
- package/dist-engine-src/src/sql2/catalog/registry.rs +556 -0
- package/dist-engine-src/src/sql2/catalog/schema.rs +88 -0
- package/dist-engine-src/src/sql2/catalog/surface.rs +41 -0
- package/dist-engine-src/src/sql2/change_materialization.rs +122 -0
- package/dist-engine-src/src/sql2/context.rs +36 -30
- package/dist-engine-src/src/sql2/error.rs +1 -1
- package/dist-engine-src/src/sql2/exec/bound_public_write.rs +1593 -0
- package/dist-engine-src/src/sql2/exec/datafusion.rs +5266 -0
- package/dist-engine-src/src/sql2/exec/fast_write.rs +82 -0
- package/dist-engine-src/src/sql2/exec/mod.rs +24 -0
- package/dist-engine-src/src/sql2/exec/write.rs +661 -0
- package/dist-engine-src/src/sql2/filesystem_planner.rs +72 -77
- package/dist-engine-src/src/sql2/filesystem_visibility.rs +21 -21
- package/dist-engine-src/src/sql2/history_projection.rs +8 -8
- package/dist-engine-src/src/sql2/history_route.rs +35 -31
- package/dist-engine-src/src/sql2/mod.rs +28 -23
- package/dist-engine-src/src/sql2/optimize/datafusion.rs +1 -0
- package/dist-engine-src/src/sql2/optimize/mod.rs +2 -0
- package/dist-engine-src/src/sql2/optimize/simple_write.rs +116 -0
- package/dist-engine-src/src/sql2/parse/mod.rs +69 -0
- package/dist-engine-src/src/sql2/parse/normalize.rs +1 -0
- package/dist-engine-src/src/sql2/plan/branch_scope.rs +24 -0
- package/dist-engine-src/src/sql2/plan/mod.rs +5 -0
- package/dist-engine-src/src/sql2/plan/predicate.rs +22 -0
- package/dist-engine-src/src/sql2/plan/write.rs +147 -0
- package/dist-engine-src/src/sql2/predicate_typecheck.rs +258 -0
- package/dist-engine-src/src/sql2/{version_provider.rs → providers/branch.rs} +218 -214
- package/dist-engine-src/src/sql2/{change_provider.rs → providers/change.rs} +156 -42
- package/dist-engine-src/src/sql2/{directory_provider.rs → providers/directory.rs} +291 -322
- package/dist-engine-src/src/sql2/{directory_history_provider.rs → providers/directory_history.rs} +56 -42
- package/dist-engine-src/src/sql2/providers/entity.rs +1484 -0
- package/dist-engine-src/src/sql2/{entity_history_provider.rs → providers/entity_history.rs} +43 -31
- package/dist-engine-src/src/sql2/{file_provider.rs → providers/file.rs} +323 -316
- package/dist-engine-src/src/sql2/{file_history_provider.rs → providers/file_history.rs} +60 -46
- package/dist-engine-src/src/sql2/{history_provider.rs → providers/history.rs} +46 -32
- package/dist-engine-src/src/sql2/{lix_state_provider.rs → providers/lix_state.rs} +359 -329
- package/dist-engine-src/src/sql2/providers/mod.rs +508 -0
- package/dist-engine-src/src/sql2/read_only.rs +2 -2
- package/dist-engine-src/src/sql2/session.rs +47 -96
- package/dist-engine-src/src/sql2/storage/constraints.rs +1 -0
- package/dist-engine-src/src/sql2/storage/mod.rs +1 -0
- package/dist-engine-src/src/sql2/test_support/differential.rs +712 -0
- package/dist-engine-src/src/sql2/test_support/generators.rs +354 -0
- package/dist-engine-src/src/sql2/test_support/mod.rs +2 -0
- package/dist-engine-src/src/sql2/udfs/{lix_active_version_commit_id.rs → lix_active_branch_commit_id.rs} +7 -7
- package/dist-engine-src/src/sql2/udfs/mod.rs +3 -6
- package/dist-engine-src/src/sql2/write_normalization.rs +45 -22
- package/dist-engine-src/src/storage/conformance.rs +399 -0
- package/dist-engine-src/src/storage/context.rs +552 -288
- package/dist-engine-src/src/storage/mod.rs +48 -10
- package/dist-engine-src/src/storage/point.rs +440 -0
- package/dist-engine-src/src/storage/read_scope.rs +43 -64
- package/dist-engine-src/src/storage/reader.rs +867 -0
- package/dist-engine-src/src/storage/scan.rs +784 -0
- package/dist-engine-src/src/storage/spaces.rs +236 -0
- package/dist-engine-src/src/storage/stats.rs +80 -0
- package/dist-engine-src/src/storage/write_set.rs +962 -0
- package/dist-engine-src/src/storage_bench.rs +136 -4828
- package/dist-engine-src/src/test_support.rs +360 -138
- package/dist-engine-src/src/tracked_state/bench_support.rs +394 -0
- package/dist-engine-src/src/tracked_state/codec.rs +155 -1057
- package/dist-engine-src/src/tracked_state/commit_root_rebuild.rs +358 -0
- package/dist-engine-src/src/tracked_state/context.rs +1927 -993
- package/dist-engine-src/src/tracked_state/diff.rs +1715 -261
- package/dist-engine-src/src/tracked_state/merge.rs +74 -88
- package/dist-engine-src/src/tracked_state/mod.rs +19 -16
- package/dist-engine-src/src/tracked_state/{materialization.rs → row_materialization.rs} +50 -178
- package/dist-engine-src/src/tracked_state/storage.rs +243 -191
- package/dist-engine-src/src/tracked_state/tree.rs +247 -371
- package/dist-engine-src/src/tracked_state/types.rs +49 -42
- package/dist-engine-src/src/transaction/bench_support.rs +407 -0
- package/dist-engine-src/src/transaction/commit.rs +821 -713
- package/dist-engine-src/src/transaction/context.rs +705 -600
- package/dist-engine-src/src/transaction/mod.rs +13 -2
- package/dist-engine-src/src/transaction/normalization.rs +63 -76
- package/dist-engine-src/src/transaction/prep.rs +13 -13
- package/dist-engine-src/src/transaction/schema_resolver.rs +19 -5
- package/dist-engine-src/src/transaction/staging.rs +228 -434
- package/dist-engine-src/src/transaction/types.rs +41 -98
- package/dist-engine-src/src/transaction/validation.rs +382 -446
- package/dist-engine-src/src/untracked_state/codec.rs +337 -29
- package/dist-engine-src/src/untracked_state/context.rs +7 -7
- package/dist-engine-src/src/untracked_state/materialization.rs +2 -2
- package/dist-engine-src/src/untracked_state/mod.rs +1 -1
- package/dist-engine-src/src/untracked_state/storage.rs +659 -157
- package/dist-engine-src/src/untracked_state/types.rs +21 -21
- package/package.json +71 -68
- package/dist-engine-src/src/backend/kv.rs +0 -358
- package/dist-engine-src/src/backend/testing.rs +0 -658
- package/dist-engine-src/src/commit_store/codec.rs +0 -887
- package/dist-engine-src/src/commit_store/context.rs +0 -944
- package/dist-engine-src/src/commit_store/materialization.rs +0 -84
- package/dist-engine-src/src/commit_store/mod.rs +0 -16
- package/dist-engine-src/src/commit_store/storage.rs +0 -600
- package/dist-engine-src/src/commit_store/types.rs +0 -215
- package/dist-engine-src/src/schema/builtin/lix_version_descriptor.json +0 -34
- package/dist-engine-src/src/schema/builtin/lix_version_ref.json +0 -48
- package/dist-engine-src/src/session/create_version.rs +0 -88
- package/dist-engine-src/src/session/merge/apply.rs +0 -23
- package/dist-engine-src/src/session/optimization9_sql2_bench.rs +0 -100
- package/dist-engine-src/src/session/switch_version.rs +0 -110
- package/dist-engine-src/src/sql2/entity_provider.rs +0 -3211
- package/dist-engine-src/src/sql2/execute.rs +0 -3533
- package/dist-engine-src/src/sql2/public_bind/assignment.rs +0 -46
- package/dist-engine-src/src/sql2/public_bind/capability.rs +0 -41
- package/dist-engine-src/src/sql2/public_bind/dml.rs +0 -172
- package/dist-engine-src/src/sql2/public_bind/mod.rs +0 -26
- package/dist-engine-src/src/sql2/public_bind/table.rs +0 -168
- package/dist-engine-src/src/sql2/version_scope.rs +0 -394
- package/dist-engine-src/src/storage/types.rs +0 -501
- package/dist-engine-src/src/tracked_state/by_file_index.rs +0 -98
- package/dist-engine-src/src/tracked_state/materializer.rs +0 -488
- package/dist-engine-src/src/transaction/live_state_overlay.rs +0 -35
- package/dist-engine-src/src/version/lifecycle.rs +0 -221
- package/dist-engine-src/src/version/mod.rs +0 -13
- package/dist-engine-src/src/version/refs.rs +0 -330
- package/dist-engine-src/src/version/stage_rows.rs +0 -67
- package/dist-engine-src/src/version/types.rs +0 -21
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"x-lix-default": "lix_uuid_v7()",
|
|
12
12
|
"description": "Stable identifier for this change."
|
|
13
13
|
},
|
|
14
|
-
"
|
|
14
|
+
"entity_pk": {
|
|
15
15
|
"type": "array",
|
|
16
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
17
|
"items": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"string",
|
|
29
29
|
"null"
|
|
30
30
|
],
|
|
31
|
-
"description": "Filesystem-scoped file identifier when the change belongs to a file; NULL for engine-internal entities (commits,
|
|
31
|
+
"description": "Filesystem-scoped file identifier when the change belongs to a file; NULL for engine-internal entities (commits, branches, settings)."
|
|
32
32
|
},
|
|
33
33
|
"metadata": {
|
|
34
34
|
"type": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"required": [
|
|
56
56
|
"id",
|
|
57
|
-
"
|
|
57
|
+
"entity_pk",
|
|
58
58
|
"schema_key",
|
|
59
59
|
"file_id",
|
|
60
60
|
"created_at"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"x-lix-key": "lix_commit",
|
|
3
|
-
"description": "A commit is a stable point in project history.
|
|
3
|
+
"description": "A commit is a stable point in project history. Branches point to commits. Use lix_commit_edge to inspect parent commits.",
|
|
4
4
|
"examples": [
|
|
5
5
|
{
|
|
6
6
|
"id": "commit_01jexample"
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"x-lix-key": "lix_label_assignment",
|
|
3
|
-
"description": "Mapping table that assigns a label to any live Lix row addressed by (
|
|
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
4
|
"x-lix-primary-key": [
|
|
5
5
|
"/id"
|
|
6
6
|
],
|
|
7
7
|
"x-lix-unique": [
|
|
8
8
|
[
|
|
9
|
-
"/
|
|
9
|
+
"/target_entity_pk",
|
|
10
10
|
"/target_schema_key",
|
|
11
11
|
"/target_file_id",
|
|
12
12
|
"/label_id"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"x-lix-state-foreign-keys": [
|
|
16
16
|
[
|
|
17
|
-
"/
|
|
17
|
+
"/target_entity_pk",
|
|
18
18
|
"/target_schema_key",
|
|
19
19
|
"/target_file_id"
|
|
20
20
|
]
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"x-lix-default": "lix_uuid_v7()",
|
|
40
40
|
"description": "Stable identifier for this label assignment row."
|
|
41
41
|
},
|
|
42
|
-
"
|
|
42
|
+
"target_entity_pk": {
|
|
43
43
|
"type": "array",
|
|
44
|
-
"description": "Target row
|
|
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
45
|
"items": {
|
|
46
46
|
"type": "string"
|
|
47
47
|
},
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"required": [
|
|
67
67
|
"id",
|
|
68
|
-
"
|
|
68
|
+
"target_entity_pk",
|
|
69
69
|
"target_schema_key",
|
|
70
70
|
"target_file_id",
|
|
71
71
|
"label_id"
|
|
@@ -12,8 +12,8 @@ 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
14
|
const LIX_COMMIT_SCHEMA_KEY: &str = "lix_commit";
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const LIX_BRANCH_DESCRIPTOR_SCHEMA_KEY: &str = "lix_branch_descriptor";
|
|
16
|
+
const LIX_BRANCH_REF_SCHEMA_KEY: &str = "lix_branch_ref";
|
|
17
17
|
const LIX_COMMIT_EDGE_SCHEMA_KEY: &str = "lix_commit_edge";
|
|
18
18
|
const LIX_FILE_DESCRIPTOR_SCHEMA_KEY: &str = "lix_file_descriptor";
|
|
19
19
|
const LIX_DIRECTORY_DESCRIPTOR_SCHEMA_KEY: &str = "lix_directory_descriptor";
|
|
@@ -28,8 +28,8 @@ const LIX_LABEL_ASSIGNMENT_SCHEMA_JSON: &str = include_str!("lix_label_assignmen
|
|
|
28
28
|
const LIX_CHANGE_SCHEMA_JSON: &str = include_str!("lix_change.json");
|
|
29
29
|
const LIX_CHANGE_AUTHOR_SCHEMA_JSON: &str = include_str!("lix_change_author.json");
|
|
30
30
|
const LIX_COMMIT_SCHEMA_JSON: &str = include_str!("lix_commit.json");
|
|
31
|
-
const
|
|
32
|
-
const
|
|
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
33
|
const LIX_COMMIT_EDGE_SCHEMA_JSON: &str = include_str!("lix_commit_edge.json");
|
|
34
34
|
const LIX_FILE_DESCRIPTOR_SCHEMA_JSON: &str = include_str!("lix_file_descriptor.json");
|
|
35
35
|
const LIX_DIRECTORY_DESCRIPTOR_SCHEMA_JSON: &str = include_str!("lix_directory_descriptor.json");
|
|
@@ -44,8 +44,8 @@ static LIX_LABEL_ASSIGNMENT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
|
44
44
|
static LIX_CHANGE_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
45
45
|
static LIX_CHANGE_AUTHOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
46
46
|
static LIX_COMMIT_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
47
|
-
static
|
|
48
|
-
static
|
|
47
|
+
static LIX_BRANCH_DESCRIPTOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
48
|
+
static LIX_BRANCH_REF_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
49
49
|
static LIX_COMMIT_EDGE_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
50
50
|
static LIX_FILE_DESCRIPTOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
51
51
|
static LIX_DIRECTORY_DESCRIPTOR_SCHEMA: OnceLock<JsonValue> = OnceLock::new();
|
|
@@ -61,8 +61,8 @@ const BUILTIN_SCHEMA_KEYS: &[&str] = &[
|
|
|
61
61
|
LIX_CHANGE_SCHEMA_KEY,
|
|
62
62
|
LIX_CHANGE_AUTHOR_SCHEMA_KEY,
|
|
63
63
|
LIX_COMMIT_SCHEMA_KEY,
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
LIX_BRANCH_DESCRIPTOR_SCHEMA_KEY,
|
|
65
|
+
LIX_BRANCH_REF_SCHEMA_KEY,
|
|
66
66
|
LIX_COMMIT_EDGE_SCHEMA_KEY,
|
|
67
67
|
LIX_FILE_DESCRIPTOR_SCHEMA_KEY,
|
|
68
68
|
LIX_DIRECTORY_DESCRIPTOR_SCHEMA_KEY,
|
|
@@ -121,16 +121,14 @@ pub(super) fn seed_schema_definition(schema_key: &str) -> Option<&'static JsonVa
|
|
|
121
121
|
LIX_COMMIT_SCHEMA
|
|
122
122
|
.get_or_init(|| parse_builtin_schema("lix_commit.json", LIX_COMMIT_SCHEMA_JSON)),
|
|
123
123
|
),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
LIX_VERSION_REF_SCHEMA_KEY => Some(LIX_VERSION_REF_SCHEMA.get_or_init(|| {
|
|
133
|
-
parse_builtin_schema("lix_version_ref.json", LIX_VERSION_REF_SCHEMA_JSON)
|
|
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)
|
|
134
132
|
})),
|
|
135
133
|
LIX_COMMIT_EDGE_SCHEMA_KEY => Some(LIX_COMMIT_EDGE_SCHEMA.get_or_init(|| {
|
|
136
134
|
parse_builtin_schema("lix_commit_edge.json", LIX_COMMIT_EDGE_SCHEMA_JSON)
|
|
@@ -165,8 +163,8 @@ pub(crate) fn builtin_schema_json(schema_key: &str) -> Option<&'static str> {
|
|
|
165
163
|
LIX_CHANGE_SCHEMA_KEY => Some(LIX_CHANGE_SCHEMA_JSON),
|
|
166
164
|
LIX_CHANGE_AUTHOR_SCHEMA_KEY => Some(LIX_CHANGE_AUTHOR_SCHEMA_JSON),
|
|
167
165
|
LIX_COMMIT_SCHEMA_KEY => Some(LIX_COMMIT_SCHEMA_JSON),
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
LIX_BRANCH_DESCRIPTOR_SCHEMA_KEY => Some(LIX_BRANCH_DESCRIPTOR_SCHEMA_JSON),
|
|
167
|
+
LIX_BRANCH_REF_SCHEMA_KEY => Some(LIX_BRANCH_REF_SCHEMA_JSON),
|
|
170
168
|
LIX_COMMIT_EDGE_SCHEMA_KEY => Some(LIX_COMMIT_EDGE_SCHEMA_JSON),
|
|
171
169
|
LIX_FILE_DESCRIPTOR_SCHEMA_KEY => Some(LIX_FILE_DESCRIPTOR_SCHEMA_JSON),
|
|
172
170
|
LIX_DIRECTORY_DESCRIPTOR_SCHEMA_KEY => Some(LIX_DIRECTORY_DESCRIPTOR_SCHEMA_JSON),
|
|
@@ -3,7 +3,7 @@ use std::collections::{BTreeMap, BTreeSet};
|
|
|
3
3
|
use serde_json::Value as JsonValue;
|
|
4
4
|
|
|
5
5
|
use crate::common::top_level_property_name;
|
|
6
|
-
use crate::
|
|
6
|
+
use crate::entity_pk::canonical_json_text;
|
|
7
7
|
use crate::LixError;
|
|
8
8
|
|
|
9
9
|
const DOC_ONLY_SCHEMA_FIELDS: &[&str] = &["$comment", "deprecated", "description", "title"];
|
|
@@ -23,7 +23,7 @@ const CONSTRAINT_FIELDS: &[&str] = &[
|
|
|
23
23
|
/// 0.6; recursive schema evolution is a later, explicit feature.
|
|
24
24
|
///
|
|
25
25
|
/// Primary-key column order is semantic because it defines composite
|
|
26
|
-
/// `
|
|
26
|
+
/// `entity_pk` tuple order, so primary keys are never normalized. Relational
|
|
27
27
|
/// constraints are frozen even when a particular addition could be
|
|
28
28
|
/// retroactively safe, such as a new FK on a new optional property. That is a
|
|
29
29
|
/// deliberate MVP rule we may relax later.
|
|
@@ -129,7 +129,7 @@ fn validate_constraints_unchanged(
|
|
|
129
129
|
schema_key: &str,
|
|
130
130
|
) -> Result<(), LixError> {
|
|
131
131
|
// Primary-key column order is semantic because it defines composite
|
|
132
|
-
//
|
|
132
|
+
// entity_pk tuple order, so it is compared directly and never normalized.
|
|
133
133
|
if previous.get("x-lix-primary-key") != next.get("x-lix-primary-key") {
|
|
134
134
|
return schema_amendment_error(format!(
|
|
135
135
|
"schema '{schema_key}' cannot amend constraint field 'x-lix-primary-key'"
|
|
@@ -344,14 +344,14 @@ mod tests {
|
|
|
344
344
|
}
|
|
345
345
|
],
|
|
346
346
|
"x-lix-state-foreign-keys": [
|
|
347
|
-
["/
|
|
347
|
+
["/target_entity_pk", "/target_schema_key", "/target_file_id"]
|
|
348
348
|
],
|
|
349
349
|
"properties": {
|
|
350
350
|
"id": { "type": "string", "description": "Stable id" },
|
|
351
351
|
"isbn": { "type": "string" },
|
|
352
352
|
"title": { "type": "string", "title": "Title" },
|
|
353
353
|
"author_id": { "type": "string" },
|
|
354
|
-
"
|
|
354
|
+
"target_entity_pk": {
|
|
355
355
|
"type": "array",
|
|
356
356
|
"items": { "type": "string" }
|
|
357
357
|
},
|
|
@@ -363,7 +363,7 @@ mod tests {
|
|
|
363
363
|
"isbn",
|
|
364
364
|
"title",
|
|
365
365
|
"author_id",
|
|
366
|
-
"
|
|
366
|
+
"target_entity_pk",
|
|
367
367
|
"target_schema_key",
|
|
368
368
|
"target_file_id"
|
|
369
369
|
],
|
|
@@ -442,8 +442,8 @@ mod tests {
|
|
|
442
442
|
}
|
|
443
443
|
]);
|
|
444
444
|
previous["x-lix-state-foreign-keys"] = json!([
|
|
445
|
-
["/
|
|
446
|
-
["/
|
|
445
|
+
["/target_entity_pk", "/target_schema_key", "/target_file_id"],
|
|
446
|
+
["/other_entity_pk", "/other_schema_key", "/other_file_id"]
|
|
447
447
|
]);
|
|
448
448
|
let mut next = previous.clone();
|
|
449
449
|
next["x-lix-unique"] = json!([["/title"], ["/isbn"]]);
|
|
@@ -464,8 +464,8 @@ mod tests {
|
|
|
464
464
|
}
|
|
465
465
|
]);
|
|
466
466
|
next["x-lix-state-foreign-keys"] = json!([
|
|
467
|
-
["/
|
|
468
|
-
["/
|
|
467
|
+
["/other_entity_pk", "/other_schema_key", "/other_file_id"],
|
|
468
|
+
["/target_entity_pk", "/target_schema_key", "/target_file_id"]
|
|
469
469
|
]);
|
|
470
470
|
|
|
471
471
|
validate_schema_amendment(&previous, &next)
|
|
@@ -480,7 +480,7 @@ mod tests {
|
|
|
480
480
|
"id",
|
|
481
481
|
"isbn",
|
|
482
482
|
"author_id",
|
|
483
|
-
"
|
|
483
|
+
"target_entity_pk",
|
|
484
484
|
"target_schema_key",
|
|
485
485
|
"target_file_id"
|
|
486
486
|
]);
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
},
|
|
117
117
|
"x-lix-state-foreign-keys": {
|
|
118
118
|
"type": "array",
|
|
119
|
-
"description": "Foreign keys from local fields to arbitrary live state rows. Each entry is exactly three required local JSON Pointers ordered as `[
|
|
119
|
+
"description": "Foreign keys from local fields to arbitrary live state rows. Each entry is exactly three required local JSON Pointers ordered as `[entity_pk, schema_key, file_id]`: index 0 points to the local entity_pk JSON array, index 1 points to the local schema_key string, and index 2 points to the local file_id string-or-null. Use explicit null for global file_id targets; omitted fields are invalid. The referenced state row is resolved in the same branch.",
|
|
120
120
|
"items": {
|
|
121
121
|
"type": "array",
|
|
122
122
|
"minItems": 3,
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
{
|
|
127
127
|
"type": "string",
|
|
128
128
|
"format": "json-pointer",
|
|
129
|
-
"description": "[0] Local JSON Pointer for the target
|
|
129
|
+
"description": "[0] Local JSON Pointer for the target entity_pk. The value must be a non-empty JSON array of strings."
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
132
|
"type": "string",
|
|
@@ -240,7 +240,7 @@ fn detect_state_foreign_key_tuple_shape(schema: &JsonValue) -> Option<LixError>
|
|
|
240
240
|
return Some(LixError::new(
|
|
241
241
|
LixError::CODE_SCHEMA_DEFINITION,
|
|
242
242
|
format!(
|
|
243
|
-
"Invalid Lix schema definition: x-lix-state-foreign-keys[{index}] must contain exactly three JSON Pointers ordered as [
|
|
243
|
+
"Invalid Lix schema definition: x-lix-state-foreign-keys[{index}] must contain exactly three JSON Pointers ordered as [entity_pk, schema_key, file_id]; [0] entity_pk, [1] schema_key, [2] file_id."
|
|
244
244
|
),
|
|
245
245
|
));
|
|
246
246
|
}
|
|
@@ -406,7 +406,7 @@ fn assert_state_foreign_key_pointers(schema: &JsonValue) -> Result<(), LixError>
|
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
let roles = [
|
|
409
|
-
("
|
|
409
|
+
("entity_pk", "a non-empty JSON array of strings"),
|
|
410
410
|
("schema_key", "a string"),
|
|
411
411
|
("file_id", "a string or null"),
|
|
412
412
|
];
|
|
@@ -430,13 +430,13 @@ fn assert_state_foreign_key_pointers(schema: &JsonValue) -> Result<(), LixError>
|
|
|
430
430
|
return Err(LixError::new(
|
|
431
431
|
LixError::CODE_SCHEMA_DEFINITION,
|
|
432
432
|
format!(
|
|
433
|
-
"Invalid Lix schema definition: x-lix-state-foreign-keys[{index}][{slot}] ({role}) property \"{pointer}\" must be required. Tuple order is [
|
|
433
|
+
"Invalid Lix schema definition: x-lix-state-foreign-keys[{index}][{slot}] ({role}) property \"{pointer}\" must be required. Tuple order is [entity_pk, schema_key, file_id]."
|
|
434
434
|
),
|
|
435
435
|
));
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
let valid = match *role {
|
|
439
|
-
"
|
|
439
|
+
"entity_pk" => schema_property_is_string_array(property_schema),
|
|
440
440
|
"schema_key" => schema_property_is_string_only(property_schema),
|
|
441
441
|
"file_id" => schema_property_is_string_or_null(property_schema),
|
|
442
442
|
_ => unreachable!("state foreign key roles are exhaustive"),
|
|
@@ -445,7 +445,7 @@ fn assert_state_foreign_key_pointers(schema: &JsonValue) -> Result<(), LixError>
|
|
|
445
445
|
return Err(LixError::new(
|
|
446
446
|
LixError::CODE_SCHEMA_DEFINITION,
|
|
447
447
|
format!(
|
|
448
|
-
"Invalid Lix schema definition: x-lix-state-foreign-keys[{index}][{slot}] ({role}) property \"{pointer}\" must be {expected}. Tuple order is [
|
|
448
|
+
"Invalid Lix schema definition: x-lix-state-foreign-keys[{index}][{slot}] ({role}) property \"{pointer}\" must be {expected}. Tuple order is [entity_pk, schema_key, file_id]."
|
|
449
449
|
),
|
|
450
450
|
));
|
|
451
451
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use serde_json::Value as JsonValue;
|
|
2
2
|
|
|
3
|
-
use crate::
|
|
3
|
+
use crate::entity_pk::EntityPk;
|
|
4
4
|
use crate::LixError;
|
|
5
5
|
|
|
6
6
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
@@ -68,8 +68,8 @@ pub fn schema_from_registered_snapshot(
|
|
|
68
68
|
))
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
pub(crate) fn
|
|
72
|
-
|
|
71
|
+
pub(crate) fn registered_schema_entity_pk(schema_key: &str) -> Result<EntityPk, LixError> {
|
|
72
|
+
EntityPk::from_primary_key_paths(
|
|
73
73
|
&serde_json::json!({
|
|
74
74
|
"value": {
|
|
75
75
|
"x-lix-key": schema_key,
|
|
@@ -13,7 +13,7 @@ pub use definition::{
|
|
|
13
13
|
lix_schema_definition, lix_schema_definition_json, validate_lix_schema,
|
|
14
14
|
validate_lix_schema_definition,
|
|
15
15
|
};
|
|
16
|
-
pub(crate) use key::
|
|
16
|
+
pub(crate) use key::registered_schema_entity_pk;
|
|
17
17
|
pub use key::{schema_from_registered_snapshot, schema_key_from_definition, SchemaKey};
|
|
18
18
|
#[cfg(test)]
|
|
19
19
|
pub(crate) use seed::seed_schema_definition;
|
|
@@ -41,7 +41,7 @@ fn validate_lix_schema_definition_rejects_unprojectable_entity_properties() {
|
|
|
41
41
|
|
|
42
42
|
#[test]
|
|
43
43
|
fn validate_lix_schema_definition_rejects_reserved_lix_property_prefixes() {
|
|
44
|
-
for property_name in ["
|
|
44
|
+
for property_name in ["lixcol_entity_pk", "lix_internal", "lixfoo"] {
|
|
45
45
|
let schema = json!({
|
|
46
46
|
"x-lix-key": "test_entity",
|
|
47
47
|
"type": "object",
|
|
@@ -196,7 +196,7 @@ fn validate_lix_schema_definition_rejects_missing_primary_key_properties() {
|
|
|
196
196
|
"value": { "type": "string" }
|
|
197
197
|
},
|
|
198
198
|
"required": ["value"],
|
|
199
|
-
"x-lix-primary-key": ["/
|
|
199
|
+
"x-lix-primary-key": ["/entity_pk"],
|
|
200
200
|
"additionalProperties": false
|
|
201
201
|
});
|
|
202
202
|
|
|
@@ -255,7 +255,7 @@ fn validate_lix_schema_definition_rejects_missing_unique_constraint_properties()
|
|
|
255
255
|
"properties": {
|
|
256
256
|
"value": { "type": "string" }
|
|
257
257
|
},
|
|
258
|
-
"x-lix-unique": [["/
|
|
258
|
+
"x-lix-unique": [["/entity_pk", "/value"]],
|
|
259
259
|
"additionalProperties": false
|
|
260
260
|
});
|
|
261
261
|
|
|
@@ -420,7 +420,7 @@ fn x_lix_entity_views_is_rejected() {
|
|
|
420
420
|
let schema = json!({
|
|
421
421
|
"type": "object",
|
|
422
422
|
"x-lix-key": "mock",
|
|
423
|
-
"x-lix-entity-views": ["lix_state", "
|
|
423
|
+
"x-lix-entity-views": ["lix_state", "lix_state_by_branch"],
|
|
424
424
|
"properties": {
|
|
425
425
|
"name": { "type": "string" }
|
|
426
426
|
},
|
|
@@ -453,13 +453,13 @@ fn x_lix_primary_key_must_be_array_of_strings_when_present() {
|
|
|
453
453
|
let schema = json!({
|
|
454
454
|
"type": "object",
|
|
455
455
|
"x-lix-key": "mock",
|
|
456
|
-
"x-lix-primary-key": ["/id", "/
|
|
456
|
+
"x-lix-primary-key": ["/id", "/branch"],
|
|
457
457
|
"properties": {
|
|
458
458
|
"id": { "type": "string" },
|
|
459
|
-
"
|
|
459
|
+
"branch": { "type": "string" },
|
|
460
460
|
"name": { "type": "string" }
|
|
461
461
|
},
|
|
462
|
-
"required": ["id", "
|
|
462
|
+
"required": ["id", "branch", "name"],
|
|
463
463
|
"additionalProperties": false
|
|
464
464
|
});
|
|
465
465
|
|
|
@@ -525,7 +525,7 @@ fn x_lix_foreign_keys_reject_duplicate_pointers() {
|
|
|
525
525
|
"properties": ["/local", "/local"],
|
|
526
526
|
"references": {
|
|
527
527
|
"schemaKey": "remote_schema",
|
|
528
|
-
"properties": ["/id", "/
|
|
528
|
+
"properties": ["/id", "/branch"]
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
531
|
],
|
|
@@ -641,7 +641,7 @@ fn x_lix_state_foreign_keys_with_ordered_state_address_tuple() {
|
|
|
641
641
|
"type": "object",
|
|
642
642
|
"x-lix-key": "label_assignment",
|
|
643
643
|
"x-lix-state-foreign-keys": [
|
|
644
|
-
["/
|
|
644
|
+
["/target_entity_pk", "/target_schema_key", "/target_file_id"]
|
|
645
645
|
],
|
|
646
646
|
"x-lix-foreign-keys": [
|
|
647
647
|
{
|
|
@@ -653,7 +653,7 @@ fn x_lix_state_foreign_keys_with_ordered_state_address_tuple() {
|
|
|
653
653
|
}
|
|
654
654
|
],
|
|
655
655
|
"properties": {
|
|
656
|
-
"
|
|
656
|
+
"target_entity_pk": {
|
|
657
657
|
"type": "array",
|
|
658
658
|
"items": { "type": "string" },
|
|
659
659
|
"minItems": 1
|
|
@@ -662,7 +662,7 @@ fn x_lix_state_foreign_keys_with_ordered_state_address_tuple() {
|
|
|
662
662
|
"target_file_id": { "type": ["string", "null"] },
|
|
663
663
|
"label_id": { "type": "string" }
|
|
664
664
|
},
|
|
665
|
-
"required": ["
|
|
665
|
+
"required": ["target_entity_pk", "target_schema_key", "target_file_id", "label_id"],
|
|
666
666
|
"additionalProperties": false
|
|
667
667
|
});
|
|
668
668
|
|
|
@@ -675,10 +675,10 @@ fn x_lix_state_foreign_keys_rejects_wrong_tuple_order_by_type() {
|
|
|
675
675
|
"type": "object",
|
|
676
676
|
"x-lix-key": "bad_label_assignment",
|
|
677
677
|
"x-lix-state-foreign-keys": [
|
|
678
|
-
["/target_schema_key", "/
|
|
678
|
+
["/target_schema_key", "/target_entity_pk", "/target_file_id"]
|
|
679
679
|
],
|
|
680
680
|
"properties": {
|
|
681
|
-
"
|
|
681
|
+
"target_entity_pk": {
|
|
682
682
|
"type": "array",
|
|
683
683
|
"items": { "type": "string" },
|
|
684
684
|
"minItems": 1
|
|
@@ -686,14 +686,14 @@ fn x_lix_state_foreign_keys_rejects_wrong_tuple_order_by_type() {
|
|
|
686
686
|
"target_schema_key": { "type": "string" },
|
|
687
687
|
"target_file_id": { "type": ["string", "null"] }
|
|
688
688
|
},
|
|
689
|
-
"required": ["
|
|
689
|
+
"required": ["target_entity_pk", "target_schema_key", "target_file_id"],
|
|
690
690
|
"additionalProperties": false
|
|
691
691
|
});
|
|
692
692
|
|
|
693
693
|
let err =
|
|
694
694
|
validate_lix_schema_definition(&schema).expect_err("wrong tuple order should be rejected");
|
|
695
695
|
assert!(
|
|
696
|
-
err.message.contains("[
|
|
696
|
+
err.message.contains("[entity_pk, schema_key, file_id]"),
|
|
697
697
|
"unexpected error: {err:?}"
|
|
698
698
|
);
|
|
699
699
|
}
|
|
@@ -704,10 +704,10 @@ fn x_lix_state_foreign_keys_requires_address_tuple_properties() {
|
|
|
704
704
|
"type": "object",
|
|
705
705
|
"x-lix-key": "optional_label_assignment",
|
|
706
706
|
"x-lix-state-foreign-keys": [
|
|
707
|
-
["/
|
|
707
|
+
["/target_entity_pk", "/target_schema_key", "/target_file_id"]
|
|
708
708
|
],
|
|
709
709
|
"properties": {
|
|
710
|
-
"
|
|
710
|
+
"target_entity_pk": {
|
|
711
711
|
"type": "array",
|
|
712
712
|
"items": { "type": "string" },
|
|
713
713
|
"minItems": 1
|
|
@@ -715,7 +715,7 @@ fn x_lix_state_foreign_keys_requires_address_tuple_properties() {
|
|
|
715
715
|
"target_schema_key": { "type": "string" },
|
|
716
716
|
"target_file_id": { "type": ["string", "null"] }
|
|
717
717
|
},
|
|
718
|
-
"required": ["
|
|
718
|
+
"required": ["target_entity_pk", "target_schema_key"],
|
|
719
719
|
"additionalProperties": false
|
|
720
720
|
});
|
|
721
721
|
|