expressir 2.4.85 → 2.4.86

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 692357a8250b0effac9d0635ab4262aca83bd7a983f45f10071ba31189942d69
4
- data.tar.gz: f3730365aa5226fc12705b7630f2e36d21b8786bc4898b817b76d7132938e63b
3
+ metadata.gz: c75af795800b06550920d64e0f7df8814b34d71702b43ee14658d0c9f09ea4da
4
+ data.tar.gz: 9037635bb2062ea14f2e2117f8349605b50d274e8d8a6870129234681768c2bc
5
5
  SHA512:
6
- metadata.gz: 2f27adc988fd88e6135e09e8438389764649a2a0c1fca966c3300de01183a18ef9987399c561d0597c99fbd5fc77daa9398deceecdc8545199bb0b1c09b37992
7
- data.tar.gz: 858ffe8c574f81f93f3209ddaa6de337e1bc0da01321796771e02c37be42647a2b94793bbd36bb335d9950c16e21fb736dc68c659d75e5f610971a6e3b933825
6
+ metadata.gz: 4cd731cac7cd2bff914e4958735031cf3e5ebd921c927e4bfa3bf2ef27bf254612902b9fe5793f7511a418ea568a7d7e6d6a021f56fd8a209247376c67ebf8eb
7
+ data.tar.gz: 42b5eaca7cae87253ad89c55431098920889ddda59c808b9105e2dcaeed0c46af51c4f8a080ebb717c3df5497238eea994fcefc334c6ddb7f94965bccbf21e4f
data/ENGINE-COMPAT.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "engine_commit": "e6ab170df8d6a93dd4e966a6188891009df592da",
2
+ "engine_commit": "2b0c6fdde8e1aae8fbc48fc1724a789ff7fe1ebb",
3
3
  "rubygems": "2.4.83",
4
- "ext": "v0.1.62",
4
+ "ext": "v0.1.63",
5
5
  "crates": "1.5.1",
6
6
  "npm": null,
7
7
  "pypi": null,
8
- "released_at": "2026-11-24T00:00:00Z",
8
+ "released_at": "2026-11-25T00:00:00Z",
9
9
  "_comment": "expressir#618 \u2014 the engine-compat manifest, mirroring parsanol-rs#423. Maps the expressir gem train to the expressir-rs ext tag and its engine commit; the null fields fill as the crates/npm/pypi tiers land (expressir#619/#622/#621). tools/check_engine_compat.rb verifies the pairings in CI; every release train updates this file."
10
10
  }
@@ -13,7 +13,7 @@ magnus = { version = "0.9" }
13
13
  # Pinned core release (M1, TODO.parity-ee/19): the ext never floats
14
14
  # main — bump the tag per expressir release, alongside the validation
15
15
  # run that pins it.
16
- expressir = { git = "https://github.com/lutaml/expressir-rs", tag = "v0.1.62" }
16
+ expressir = { git = "https://github.com/lutaml/expressir-rs", tag = "v0.1.63" }
17
17
  serde_json = "1.0"
18
18
 
19
19
 
@@ -782,6 +782,7 @@ fn init(ruby: &Ruby) -> Result<(), Error> {
782
782
  module.define_singleton_method("lsp_inventory", function!(lsp_inventory, 1))?;
783
783
  module.define_singleton_method("lsp_rename_edits", function!(lsp_rename_edits, 2))?;
784
784
  module.define_singleton_method("write_set", function!(set_write, 3))?;
785
+ module.define_singleton_method("concat_schema", function!(concat_schema, 2))?;
785
786
  let batch_class = module.define_class("BatchStream", ruby.class_object())?;
786
787
  batch_class.define_singleton_method("start", function!(batch_start, 2))?;
787
788
  batch_class.define_method("next", method!(batch_next, 0))?;
@@ -799,3 +800,26 @@ fn init(ruby: &Ruby) -> Result<(), Error> {
799
800
  set_class.define_method("matches_sources", method!(set_matches_sources, 1))?;
800
801
  Ok(())
801
802
  }
803
+
804
+ /// The concatenated artifact over a hydrated repository wire (#636):
805
+ /// `wire_json` is the repository wire, `root_id` the schema to expand.
806
+ /// Returns `[ids, artifact]` — the closure ids and the artifact text
807
+ /// (the sections embed the files the wire names).
808
+ fn concat_schema(ruby: &Ruby, wire_json: String, root_id: String) -> Result<RArray, Error> {
809
+ let wire: serde_json::Value =
810
+ serde_json::from_str(&wire_json).map_err(|e| {
811
+ Error::new(ruby.exception_runtime_error(), format!("wire json: {e}"))
812
+ })?;
813
+ let sections = expressir::expand::closure(&root_id, &wire);
814
+ let artifact = expressir::expand::write(&sections).map_err(|e| {
815
+ Error::new(ruby.exception_runtime_error(), format!("concat: {e}"))
816
+ })?;
817
+ let ids = ruby.ary_new_capa(sections.len());
818
+ for section in &sections {
819
+ ids.push(ruby.str_new(&section.id));
820
+ }
821
+ let out = ruby.ary_new_capa(2);
822
+ out.push(ids);
823
+ out.push(ruby.str_new(&artifact));
824
+ Ok(out)
825
+ }
@@ -66,14 +66,44 @@ module Expressir
66
66
  end
67
67
 
68
68
  # One-call convenience: closure of the root schema found in
69
- # `repository`, written to `path`.
69
+ # `repository`, written to `path`. The closure walk runs in the
70
+ # Rust core when the extension is available (the wire carries the
71
+ # same interfaces); the Ruby walk stays as the fallback for the
72
+ # no-native lane (#636). Both return the same schema set — the
73
+ # writer is shared.
70
74
  def call(root_schema, repository, path)
75
+ if Expressir::Express::Core::NATIVE_AVAILABLE &&
76
+ ::Expressir::Core.respond_to?(:concat_schema)
77
+ begin
78
+ # The wrapper serializes the repository's wire; the raw
79
+ # extension function takes the JSON string.
80
+ ids, artifact = Expressir::Express::Core.concat_schema(repository, root_schema)
81
+ write_artifact(path, artifact)
82
+ lowered = ids.map(&:downcase)
83
+ repository.schemas.select { |s| lowered.include?(s.id.safe_downcase) }
84
+ .sort_by { |s| s.id.safe_downcase }
85
+ rescue NotImplementedError, RuntimeError
86
+ ruby_call(root_schema, repository, path)
87
+ end
88
+ else
89
+ ruby_call(root_schema, repository, path)
90
+ end
91
+ end
92
+
93
+ # The Ruby closure walk + writer.
94
+ def ruby_call(root_schema, repository, path)
71
95
  schemas = closure(root_schema, repository)
72
96
  File.open(path, "w") do |file|
73
97
  write(file, schemas)
74
98
  end
75
99
  schemas
76
100
  end
101
+
102
+ # Writes a pre-rendered artifact text (the native path's output).
103
+ def write_artifact(path, artifact)
104
+ File.binwrite(path, artifact)
105
+ end
106
+ module_function :call, :ruby_call, :write_artifact
77
107
  end
78
108
  end
79
109
  end
@@ -256,6 +256,24 @@ module Expressir
256
256
  yield(path, model, error)
257
257
  end
258
258
  end
259
+
260
+ # The concatenated artifact over a resolved repository (#636):
261
+ # the interface closure of `root` in `repository` plus the artifact
262
+ # text (the sections embed the files the wire names). Returns
263
+ # [schema_ids, artifact] from the Rust closure walk.
264
+ def self.concat_schema(repository, root)
265
+ unless NATIVE_AVAILABLE && ::Expressir::Core.respond_to?(:concat_schema)
266
+ raise NotImplementedError, "core concat unavailable"
267
+ end
268
+
269
+ # The repository's wire nests schemas under files; the Rust
270
+ # closure consumes the flat ExpFile shape ({"schemas": [...]}).
271
+ wire = JSON.generate(
272
+ "schemas" => Array(repository.schemas).map(&:to_hash),
273
+ )
274
+ ids, artifact = ::Expressir::Core.concat_schema(wire, root.id)
275
+ [ids, artifact]
276
+ end
259
277
  end
260
278
  end
261
279
  end
@@ -3,6 +3,6 @@ module Expressir
3
3
  # autoload it (Ruby autoload only works for module/class constants, not
4
4
  # for string constants like `Expressir::VERSION`).
5
5
  module Version
6
- VERSION = "2.4.85".freeze
6
+ VERSION = "2.4.86".freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expressir
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.85
4
+ version: 2.4.86
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.