rusty-haystack 0.3.1__tar.gz → 0.4.3__tar.gz

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 (95) hide show
  1. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/Cargo.lock +6 -5
  2. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/Cargo.toml +1 -1
  3. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/PKG-INFO +1 -1
  4. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/auth.rs +44 -6
  5. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/graph/entity_graph.rs +5 -0
  6. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/graph/shared.rs +5 -0
  7. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/pyproject.toml +1 -1
  8. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/rusty-haystack/Cargo.toml +1 -1
  9. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/README.md +0 -0
  10. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/Cargo.toml +0 -0
  11. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/benches/benchmarks.rs +0 -0
  12. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/defs.trio +0 -0
  13. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/tz_map.txt +0 -0
  14. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/units.txt +0 -0
  15. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/ph.attrs.xeto +0 -0
  16. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/ph.equips.xeto +0 -0
  17. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/ph.examples.xeto +0 -0
  18. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/ph.points.elec.xeto +0 -0
  19. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/ph.points.xeto +0 -0
  20. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/ph.protocols.xeto +0 -0
  21. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/ph.xeto +0 -0
  22. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/sys.api.xeto +0 -0
  23. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/sys.comp.xeto +0 -0
  24. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/sys.files.xeto +0 -0
  25. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/sys.template.xeto +0 -0
  26. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/data/xeto/sys.xeto +0 -0
  27. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/csv.rs +0 -0
  28. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/json/mod.rs +0 -0
  29. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/json/v3.rs +0 -0
  30. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/json/v4.rs +0 -0
  31. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/mod.rs +0 -0
  32. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/rdf.rs +0 -0
  33. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/shared.rs +0 -0
  34. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/trio/encoder.rs +0 -0
  35. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/trio/mod.rs +0 -0
  36. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/trio/parser.rs +0 -0
  37. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/zinc/encoder.rs +0 -0
  38. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/zinc/mod.rs +0 -0
  39. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/codecs/zinc/parser.rs +0 -0
  40. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/data/dict.rs +0 -0
  41. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/data/grid.rs +0 -0
  42. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/data/list.rs +0 -0
  43. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/data/mod.rs +0 -0
  44. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/filter/ast.rs +0 -0
  45. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/filter/eval.rs +0 -0
  46. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/filter/mod.rs +0 -0
  47. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/filter/parser.rs +0 -0
  48. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/graph/adjacency.rs +0 -0
  49. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/graph/bitmap.rs +0 -0
  50. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/graph/changelog.rs +0 -0
  51. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/graph/mod.rs +0 -0
  52. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/graph/query_planner.rs +0 -0
  53. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/coord.rs +0 -0
  54. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/datetime.rs +0 -0
  55. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/kind.rs +0 -0
  56. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/mod.rs +0 -0
  57. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/number.rs +0 -0
  58. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/ref_.rs +0 -0
  59. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/singletons.rs +0 -0
  60. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/symbol.rs +0 -0
  61. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/tz.rs +0 -0
  62. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/units.rs +0 -0
  63. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/uri.rs +0 -0
  64. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/kinds/xstr.rs +0 -0
  65. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/lib.rs +0 -0
  66. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/ontology/conjunct.rs +0 -0
  67. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/ontology/def.rs +0 -0
  68. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/ontology/lib.rs +0 -0
  69. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/ontology/mod.rs +0 -0
  70. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/ontology/namespace.rs +0 -0
  71. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/ontology/taxonomy.rs +0 -0
  72. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/ontology/trio_loader.rs +0 -0
  73. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/ontology/validation.rs +0 -0
  74. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/xeto/ast.rs +0 -0
  75. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/xeto/bundled.rs +0 -0
  76. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/xeto/export.rs +0 -0
  77. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/xeto/fitting.rs +0 -0
  78. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/xeto/lexer.rs +0 -0
  79. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/xeto/loader.rs +0 -0
  80. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/xeto/mod.rs +0 -0
  81. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/xeto/parser.rs +0 -0
  82. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/xeto/resolver.rs +0 -0
  83. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/src/xeto/spec.rs +0 -0
  84. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/tests/e2e.rs +0 -0
  85. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/tests/graph_integration.rs +0 -0
  86. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/haystack-core/tests/ontology_integration.rs +0 -0
  87. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/rusty-haystack/README.md +0 -0
  88. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/rusty-haystack/src/codecs.rs +0 -0
  89. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/rusty-haystack/src/convert.rs +0 -0
  90. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/rusty-haystack/src/data.rs +0 -0
  91. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/rusty-haystack/src/filter.rs +0 -0
  92. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/rusty-haystack/src/graph.rs +0 -0
  93. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/rusty-haystack/src/kinds.rs +0 -0
  94. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/rusty-haystack/src/lib.rs +0 -0
  95. {rusty_haystack-0.3.1 → rusty_haystack-0.4.3}/rusty-haystack/src/ontology.rs +0 -0
@@ -2072,7 +2072,7 @@ dependencies = [
2072
2072
 
2073
2073
  [[package]]
2074
2074
  name = "rusty-haystack"
2075
- version = "0.3.1"
2075
+ version = "0.4.3"
2076
2076
  dependencies = [
2077
2077
  "chrono",
2078
2078
  "pyo3",
@@ -2081,9 +2081,10 @@ dependencies = [
2081
2081
 
2082
2082
  [[package]]
2083
2083
  name = "rusty-haystack-cli"
2084
- version = "0.3.1"
2084
+ version = "0.4.3"
2085
2085
  dependencies = [
2086
2086
  "clap",
2087
+ "env_logger",
2087
2088
  "rusty-haystack-client",
2088
2089
  "rusty-haystack-core",
2089
2090
  "rusty-haystack-server",
@@ -2094,7 +2095,7 @@ dependencies = [
2094
2095
 
2095
2096
  [[package]]
2096
2097
  name = "rusty-haystack-client"
2097
- version = "0.3.1"
2098
+ version = "0.4.3"
2098
2099
  dependencies = [
2099
2100
  "base64",
2100
2101
  "futures-util",
@@ -2111,7 +2112,7 @@ dependencies = [
2111
2112
 
2112
2113
  [[package]]
2113
2114
  name = "rusty-haystack-core"
2114
- version = "0.3.1"
2115
+ version = "0.4.3"
2115
2116
  dependencies = [
2116
2117
  "base64",
2117
2118
  "chrono",
@@ -2136,7 +2137,7 @@ dependencies = [
2136
2137
 
2137
2138
  [[package]]
2138
2139
  name = "rusty-haystack-server"
2139
- version = "0.3.1"
2140
+ version = "0.4.3"
2140
2141
  dependencies = [
2141
2142
  "actix-http",
2142
2143
  "actix-rt",
@@ -3,7 +3,7 @@ resolver = "2"
3
3
  members = ["haystack-core", "rusty-haystack"]
4
4
 
5
5
  [workspace.package]
6
- version = "0.3.1"
6
+ version = "0.4.3"
7
7
  edition = "2024"
8
8
  rust-version = "1.93"
9
9
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rusty-haystack
3
- Version: 0.3.1
3
+ Version: 0.4.3
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: 3.11
@@ -71,6 +71,8 @@ pub struct ScramHandshake {
71
71
  pub enum AuthHeader {
72
72
  Hello {
73
73
  username: String,
74
+ /// Base64-encoded client-first-message (contains the client nonce).
75
+ data: Option<String>,
74
76
  },
75
77
  Scram {
76
78
  handshake_token: String,
@@ -367,6 +369,30 @@ pub fn server_verify_final(
367
369
  Ok(handshake.server_signature.clone())
368
370
  }
369
371
 
372
+ /// Extract the client nonce from a base64-encoded client-first-message.
373
+ ///
374
+ /// The client-first-message format is `n,,n=<username>,r=<client_nonce>`.
375
+ /// Returns the raw nonce string.
376
+ pub fn extract_client_nonce(client_first_b64: &str) -> Result<String, AuthError> {
377
+ let bytes = BASE64
378
+ .decode(client_first_b64)
379
+ .map_err(|e| AuthError::Base64Error(e.to_string()))?;
380
+ let msg = String::from_utf8(bytes).map_err(|e| AuthError::HandshakeFailed(e.to_string()))?;
381
+ // Strip GS2 header "n,," prefix
382
+ let bare = msg
383
+ .strip_prefix("n,,")
384
+ .ok_or_else(|| AuthError::HandshakeFailed("missing GS2 header in client-first".into()))?;
385
+ // Parse n=<user>,r=<nonce>
386
+ for part in bare.split(',') {
387
+ if let Some(nonce) = part.strip_prefix("r=") {
388
+ return Ok(nonce.to_string());
389
+ }
390
+ }
391
+ Err(AuthError::HandshakeFailed(
392
+ "missing r= nonce in client-first-message".into(),
393
+ ))
394
+ }
395
+
370
396
  /// Parse a Haystack `Authorization` header value.
371
397
  ///
372
398
  /// Supported formats:
@@ -377,16 +403,27 @@ pub fn parse_auth_header(header: &str) -> Result<AuthHeader, AuthError> {
377
403
  let header = header.trim();
378
404
 
379
405
  if let Some(rest) = header.strip_prefix("HELLO ") {
380
- let username_b64 = rest
381
- .trim()
382
- .strip_prefix("username=")
406
+ let mut username_b64_val = None;
407
+ let mut data_val = None;
408
+ for part in rest.split(',') {
409
+ let part = part.trim();
410
+ if let Some(val) = part.strip_prefix("username=") {
411
+ username_b64_val = Some(val.trim().to_string());
412
+ } else if let Some(val) = part.strip_prefix("data=") {
413
+ data_val = Some(val.trim().to_string());
414
+ }
415
+ }
416
+ let username_b64 = username_b64_val
383
417
  .ok_or_else(|| AuthError::InvalidHeader("missing username= in HELLO".into()))?;
384
418
  let username_bytes = BASE64
385
- .decode(username_b64.trim())
419
+ .decode(&username_b64)
386
420
  .map_err(|e| AuthError::Base64Error(e.to_string()))?;
387
421
  let username = String::from_utf8(username_bytes)
388
422
  .map_err(|e| AuthError::InvalidHeader(e.to_string()))?;
389
- Ok(AuthHeader::Hello { username })
423
+ Ok(AuthHeader::Hello {
424
+ username,
425
+ data: data_val,
426
+ })
390
427
  } else if let Some(rest) = header.strip_prefix("SCRAM ") {
391
428
  let mut handshake_token = None;
392
429
  let mut data = None;
@@ -498,6 +535,7 @@ mod tests {
498
535
  parsed,
499
536
  AuthHeader::Hello {
500
537
  username: "user".to_string(),
538
+ data: None,
501
539
  }
502
540
  );
503
541
  }
@@ -557,7 +595,7 @@ mod tests {
557
595
  let hello_header = format!("HELLO username={}", username_b64);
558
596
  let parsed = parse_auth_header(&hello_header).unwrap();
559
597
  match &parsed {
560
- AuthHeader::Hello { username: u } => assert_eq!(u, username),
598
+ AuthHeader::Hello { username: u, .. } => assert_eq!(u, username),
561
599
  _ => panic!("expected Hello variant"),
562
600
  }
563
601
 
@@ -421,6 +421,11 @@ impl EntityGraph {
421
421
  self.entities.contains_key(ref_val)
422
422
  }
423
423
 
424
+ /// Returns references to all entities in the graph.
425
+ pub fn all(&self) -> Vec<&HDict> {
426
+ self.entities.values().collect()
427
+ }
428
+
424
429
  // ── Internal indexing ──
425
430
 
426
431
  /// Add tag bitmap entries for an entity.
@@ -83,6 +83,11 @@ impl SharedGraph {
83
83
  self.read(|g| g.is_empty())
84
84
  }
85
85
 
86
+ /// Return all entities as owned clones.
87
+ pub fn all_entities(&self) -> Vec<HDict> {
88
+ self.read(|g| g.all().into_iter().cloned().collect())
89
+ }
90
+
86
91
  /// Check if an entity with the given ref value exists.
87
92
  pub fn contains(&self, ref_val: &str) -> bool {
88
93
  self.read(|g| g.contains(ref_val))
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "rusty-haystack"
7
- version = "0.3.1"
7
+ dynamic = ["version"]
8
8
  description = "Fast Python bindings for Project Haystack — types, codecs (Zinc/Trio/JSON), filters, ontology, and Xeto support powered by Rust"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -9,6 +9,6 @@ name = "rusty_haystack"
9
9
  crate-type = ["cdylib"]
10
10
 
11
11
  [dependencies]
12
- haystack-core = { package = "rusty-haystack-core", path = "../haystack-core" }
12
+ haystack-core = { package = "rusty-haystack-core", version = "0.4.3", path = "../haystack-core" }
13
13
  pyo3 = { version = "0.24", features = ["extension-module"] }
14
14
  chrono = "0.4"
File without changes