@feltdb/core 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands.js +19 -21
- package/dist/cli/development-session.js +16 -0
- package/dist/cli/studio-artifact.js +33 -0
- package/dist/create/package-versions.js +1 -1
- package/dist/create/server-source/crates/feltdb/src/acceptance_tests.rs +8 -1
- package/dist/create/server-source/crates/feltdb/src/application.rs +16 -0
- package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +21 -22
- package/dist/create/server-source/crates/feltdb/src/lib.rs +451 -33
- package/dist/create/server-source/crates/feltdb/src/state_contract.rs +48 -3
- package/dist/create/server-source/crates/feltdb/src/state_model.rs +569 -4
- package/dist/create/server-source/crates/feltdb/src/state_trigger.rs +1 -0
- package/dist/create/server-source/crates/feltdb/src/versioned_object_substrate.rs +708 -0
- package/dist/create/server-source/crates/feltdb/src/worker_mesh.rs +1 -0
- package/dist/create/server-source/crates/feltdb/src/workload.rs +480 -44
- package/dist/create/server-source/crates/feltdb/tests/generalized_version_control_evidence.rs +123 -0
- package/dist/create/server-source/crates/feltdb/tests/generalized_version_control_substrate_completion.rs +281 -0
- package/dist/create/server-source/crates/feltdb/tests/production_readiness_contract.rs +15 -3
- package/dist/create/server-source/crates/feltdb/tests/revision_retention_boundary_evidence.rs +28 -18
- package/dist/create/server-source/crates/feltdb/tests/storage_independent_versioned_object_substrate.rs +328 -0
- package/dist/create/server-source/crates/feltdb/tests/workload_envelope_contract.rs +20 -3
- package/dist/create/server-source/crates/feltdb-server/src/app_state.rs +14 -4
- package/dist/create/server-source/crates/feltdb-server/src/backup.rs +0 -4
- package/dist/create/server-source/crates/feltdb-server/src/canonical_principals.rs +1093 -0
- package/dist/create/server-source/crates/feltdb-server/src/causal.rs +905 -144
- package/dist/create/server-source/crates/feltdb-server/src/connections.rs +9 -6
- package/dist/create/server-source/crates/feltdb-server/src/control_plane.rs +90 -0
- package/dist/create/server-source/crates/feltdb-server/src/lib.rs +1 -0
- package/dist/create/server-source/crates/feltdb-server/src/main.rs +408 -74
- package/dist/create/server-source/crates/feltdb-server/src/principals.rs +9 -501
- package/dist/create/server-source/crates/feltdb-server/src/tenancy.rs +22 -0
- package/dist/create/server-source/crates/feltdb-server/tests/principal_tenant_migration.rs +247 -0
- package/dist/db.d.ts +6 -5
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +18 -24
- package/dist/deployment.d.ts.map +1 -1
- package/dist/deployment.js +4 -2
- package/dist/embedded-transaction.d.ts.map +1 -1
- package/dist/embedded-transaction.js +4 -0
- package/dist/error-codes.d.ts +12 -0
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +20 -2
- package/dist/feltdb.d.ts +4 -0
- package/dist/feltdb.d.ts.map +1 -1
- package/dist/file-db.d.ts +10 -0
- package/dist/file-db.d.ts.map +1 -1
- package/dist/file-db.js +18 -0
- package/dist/http-db.d.ts +4 -0
- package/dist/http-db.d.ts.map +1 -1
- package/dist/http-db.js +73 -12
- package/dist/index-core.d.ts +1 -0
- package/dist/index-core.d.ts.map +1 -1
- package/dist/index-core.js +1 -0
- package/dist/public-contract.d.ts +112 -0
- package/dist/public-contract.d.ts.map +1 -0
- package/dist/public-contract.js +125 -0
- package/dist/studio/app.d.ts +23 -0
- package/dist/studio/app.d.ts.map +1 -1
- package/dist/studio/components/ContractInspector.d.ts +5 -0
- package/dist/studio/components/ContractInspector.d.ts.map +1 -1
- package/dist/studio/components/SettingsPanel.d.ts +4 -1
- package/dist/studio/components/SettingsPanel.d.ts.map +1 -1
- package/dist/studio/components/index.js +4 -4
- package/dist/studio/{components-CehkcX_k.js → components-CJFgdKG6.js} +322 -303
- package/dist/studio/control-plane/Data.d.ts.map +1 -1
- package/dist/studio/control-plane/Instance.d.ts +10 -0
- package/dist/studio/control-plane/Instance.d.ts.map +1 -1
- package/dist/studio/control-plane/Operations.d.ts +3 -0
- package/dist/studio/control-plane/Operations.d.ts.map +1 -1
- package/dist/studio/control-plane/State.d.ts.map +1 -1
- package/dist/studio/control-plane/index.d.ts +4 -2
- package/dist/studio/control-plane/index.d.ts.map +1 -1
- package/dist/studio/control-plane/index.js +2 -2
- package/dist/studio/control-plane-DP8ljTDO.js +3207 -0
- package/dist/studio/index.js +96 -75
- package/dist/studio/utils/api.d.ts +1 -1
- package/dist/studio/utils/api.d.ts.map +1 -1
- package/dist/studio/utils/control-plane-api.d.ts +12 -1
- package/dist/studio/utils/control-plane-api.d.ts.map +1 -1
- package/dist/studio/utils/control-plane-api.js +1 -1
- package/dist/studio/utils/index.js +16 -16
- package/dist/studio/utils/service-api.d.ts +8 -0
- package/dist/studio/utils/service-api.d.ts.map +1 -1
- package/dist/studio/utils/service-api.js +15 -12
- package/dist/studio-app/assets/{feltdb_wasm-DksXDnLa.js → feltdb_wasm-CfNb3IoF.js} +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-D9d3gY-E.wasm +0 -0
- package/dist/studio-app/assets/index-SDXdROi1.js +30 -0
- package/dist/studio-app/feltdb-studio.json +6 -0
- package/dist/studio-app/index.html +1 -1
- package/dist/transaction.d.ts +9 -1
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +6 -2
- package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
- package/dist/workspace/local-development-authority.d.ts +8 -0
- package/dist/workspace/local-development-authority.d.ts.map +1 -1
- package/dist/workspace/local-development-authority.js +136 -1
- package/package.json +2 -2
- package/dist/studio/control-plane-D6TT2fCQ.js +0 -3064
- package/dist/studio-app/assets/feltdb_wasm_bg-Yy4QRHJT.wasm +0 -0
- package/dist/studio-app/assets/index-CZ55nLgp.js +0 -30
|
@@ -2,7 +2,7 @@ use crate::{
|
|
|
2
2
|
key_provider::{
|
|
3
3
|
KeyProvider, KeyProviderHealth, KeyReference, KeyScope, LocalKeyProvider, WrappedKey,
|
|
4
4
|
},
|
|
5
|
-
|
|
5
|
+
canonical_principals::CanonicalPrincipalAuthority,
|
|
6
6
|
tenancy::TenancyStore,
|
|
7
7
|
};
|
|
8
8
|
use base64::{engine::general_purpose::STANDARD, Engine};
|
|
@@ -659,7 +659,7 @@ impl ConnectionStore {
|
|
|
659
659
|
}
|
|
660
660
|
pub fn execution_context(
|
|
661
661
|
&self,
|
|
662
|
-
principals: &
|
|
662
|
+
principals: &CanonicalPrincipalAuthority,
|
|
663
663
|
worker_id: &str,
|
|
664
664
|
workload_id: &str,
|
|
665
665
|
connection_ids: &[String],
|
|
@@ -862,7 +862,7 @@ mod tests {
|
|
|
862
862
|
Ok(())
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
|
-
fn setup() -> (TenancyStore,
|
|
865
|
+
fn setup() -> (TenancyStore, CanonicalPrincipalAuthority, ConnectionStore, String) {
|
|
866
866
|
let suffix = id("test");
|
|
867
867
|
let tenancy =
|
|
868
868
|
TenancyStore::load(std::env::temp_dir().join(format!("{suffix}-tenant.json"))).unwrap();
|
|
@@ -872,9 +872,12 @@ mod tests {
|
|
|
872
872
|
let app = tenancy
|
|
873
873
|
.create_application("owner", &tenant.id, "App")
|
|
874
874
|
.unwrap();
|
|
875
|
-
let principals =
|
|
876
|
-
|
|
877
|
-
.
|
|
875
|
+
let principals = CanonicalPrincipalAuthority::new(
|
|
876
|
+
feltdb::FeltDb::open(
|
|
877
|
+
std::env::temp_dir().join(format!("{suffix}-principal-authority.log")),
|
|
878
|
+
)
|
|
879
|
+
.unwrap(),
|
|
880
|
+
);
|
|
878
881
|
let connections = ConnectionStore::load(
|
|
879
882
|
std::env::temp_dir().join(format!("{suffix}-connections.json")),
|
|
880
883
|
[7u8; 32],
|
|
@@ -45,6 +45,7 @@ use feltdb::state_model::{
|
|
|
45
45
|
use feltdb::{Operation, OperationType};
|
|
46
46
|
use serde::{Deserialize, Serialize};
|
|
47
47
|
use serde_json::{json, Value};
|
|
48
|
+
use sha2::{Digest, Sha256};
|
|
48
49
|
|
|
49
50
|
// ============================================================================
|
|
50
51
|
// Declared capabilities
|
|
@@ -471,9 +472,61 @@ pub fn capabilities() -> Value {
|
|
|
471
472
|
"contract": "feltdb.control-plane.capabilities",
|
|
472
473
|
"version": 1,
|
|
473
474
|
"capabilities": CAPABILITIES,
|
|
475
|
+
"public_contract": {
|
|
476
|
+
"contract": "feltdb.public.substrate",
|
|
477
|
+
"contract_version": "1.0",
|
|
478
|
+
"cursor_format_version": "fh1",
|
|
479
|
+
"stored_state_schema_version": 1,
|
|
480
|
+
"migration_version": "0.10A",
|
|
481
|
+
"capabilities": public_substrate_capabilities(),
|
|
482
|
+
},
|
|
474
483
|
})
|
|
475
484
|
}
|
|
476
485
|
|
|
486
|
+
/// Stable fingerprint of the public substrate declaration served to clients.
|
|
487
|
+
///
|
|
488
|
+
/// Release certification compares this value with the live deployment. It is
|
|
489
|
+
/// derived from the declaration itself so a capability change cannot retain a
|
|
490
|
+
/// stale, hand-maintained release marker.
|
|
491
|
+
pub fn public_contract_capability_fingerprint() -> String {
|
|
492
|
+
let declaration = capabilities();
|
|
493
|
+
let public = &declaration["public_contract"];
|
|
494
|
+
format!(
|
|
495
|
+
"sha256:{:x}",
|
|
496
|
+
Sha256::digest(serde_json::to_vec(public).expect("public contract serializes"))
|
|
497
|
+
)
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
fn public_substrate_capabilities() -> Value {
|
|
501
|
+
let capability = |name: &str, transports: &[&str], scope: &str, durability: &str| {
|
|
502
|
+
json!({
|
|
503
|
+
"capability": name,
|
|
504
|
+
"contract_version": "1.0",
|
|
505
|
+
"support": "supported",
|
|
506
|
+
"supported_transport": transports,
|
|
507
|
+
"scope_requirements": scope,
|
|
508
|
+
"durability_semantics": durability,
|
|
509
|
+
"authority_owner": "canonical_feltdb",
|
|
510
|
+
})
|
|
511
|
+
};
|
|
512
|
+
json!([
|
|
513
|
+
capability("state", &["rust", "http", "sdk", "indexeddb"], "tenant+application", "commit-before-success except memory"),
|
|
514
|
+
capability("transactions", &["rust", "http", "sdk", "indexeddb"], "tenant+application", "atomic canonical commit"),
|
|
515
|
+
capability("cas", &["rust", "http", "sdk", "indexeddb"], "tenant+application+record", "authority-owned record version"),
|
|
516
|
+
capability("history", &["rust", "http", "sdk"], "tenant+application", "canonical transaction/revision history"),
|
|
517
|
+
capability("refs", &["rust"], "namespace+name", "durable-object CAS"),
|
|
518
|
+
capability("materialization", &["rust"], "durable object/revision", "projection only"),
|
|
519
|
+
capability("durable_objects", &["rust"], "backend key", "durable backend is authoritative"),
|
|
520
|
+
capability("principals", &["rust", "http", "sdk"], "tenant+application", "canonical principal transaction"),
|
|
521
|
+
capability("durable_work", &["rust", "http", "sdk"], "tenant+application", "canonical CAS-protected aggregate"),
|
|
522
|
+
capability("events", &["rust", "http", "sdk"], "authority+tenant+application", "projection of committed history"),
|
|
523
|
+
capability("opaque_cursors", &["http", "sdk"], "authority+tenant+application", "restartable scoped history position"),
|
|
524
|
+
capability("provenance", &["rust", "http", "sdk"], "tenant+application", "complete canonical history"),
|
|
525
|
+
capability("recovery", &["rust", "http", "sdk", "indexeddb"], "authority", "fresh-process reconstruction"),
|
|
526
|
+
capability("capability_discovery", &["http", "sdk"], "authenticated authority", "generated declaration"),
|
|
527
|
+
])
|
|
528
|
+
}
|
|
529
|
+
|
|
477
530
|
// ============================================================================
|
|
478
531
|
// State model projections
|
|
479
532
|
// ============================================================================
|
|
@@ -770,6 +823,43 @@ mod tests {
|
|
|
770
823
|
}
|
|
771
824
|
}
|
|
772
825
|
|
|
826
|
+
#[test]
|
|
827
|
+
fn public_substrate_declaration_is_complete_and_semantic() {
|
|
828
|
+
let declaration = capabilities();
|
|
829
|
+
let public = &declaration["public_contract"];
|
|
830
|
+
assert_eq!(public["contract"], json!("feltdb.public.substrate"));
|
|
831
|
+
assert_eq!(public["contract_version"], json!("1.0"));
|
|
832
|
+
assert_eq!(public["cursor_format_version"], json!("fh1"));
|
|
833
|
+
let entries = public["capabilities"].as_array().unwrap();
|
|
834
|
+
let names = entries
|
|
835
|
+
.iter()
|
|
836
|
+
.map(|entry| entry["capability"].as_str().unwrap())
|
|
837
|
+
.collect::<std::collections::BTreeSet<_>>();
|
|
838
|
+
for required in [
|
|
839
|
+
"state", "transactions", "cas", "history", "refs", "materialization",
|
|
840
|
+
"durable_objects", "principals", "durable_work", "events", "opaque_cursors",
|
|
841
|
+
"provenance", "recovery", "capability_discovery",
|
|
842
|
+
] {
|
|
843
|
+
assert!(names.contains(required), "missing public capability {required}");
|
|
844
|
+
}
|
|
845
|
+
for entry in entries {
|
|
846
|
+
assert_eq!(entry["support"], json!("supported"));
|
|
847
|
+
assert_eq!(entry["authority_owner"], json!("canonical_feltdb"));
|
|
848
|
+
assert!(!entry["supported_transport"].as_array().unwrap().is_empty());
|
|
849
|
+
assert!(!entry["scope_requirements"].as_str().unwrap().is_empty());
|
|
850
|
+
assert!(!entry["durability_semantics"].as_str().unwrap().is_empty());
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
#[test]
|
|
855
|
+
fn public_capability_fingerprint_is_derived_and_stable() {
|
|
856
|
+
let first = public_contract_capability_fingerprint();
|
|
857
|
+
let second = public_contract_capability_fingerprint();
|
|
858
|
+
assert_eq!(first, second);
|
|
859
|
+
assert!(first.starts_with("sha256:"));
|
|
860
|
+
assert_eq!(first.len(), "sha256:".len() + 64);
|
|
861
|
+
}
|
|
862
|
+
|
|
773
863
|
#[test]
|
|
774
864
|
fn a_path_survives_the_round_trip_with_its_component_kinds() {
|
|
775
865
|
let path = vec![
|