@alizarin/napi 2.0.0-alpha.103 → 2.0.0-alpha.105

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.
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alizarin/napi",
3
- "version": "2.0.0-alpha.103",
3
+ "version": "2.0.0-alpha.105",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,8 +30,8 @@
30
30
  "@napi-rs/cli": "^2.18.0"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@alizarin/napi-win32-x64-msvc": "2.0.0-alpha.103",
34
- "@alizarin/napi-darwin-x64": "2.0.0-alpha.103",
35
- "@alizarin/napi-linux-x64-gnu": "2.0.0-alpha.103"
33
+ "@alizarin/napi-win32-x64-msvc": "2.0.0-alpha.105",
34
+ "@alizarin/napi-darwin-x64": "2.0.0-alpha.105",
35
+ "@alizarin/napi-linux-x64-gnu": "2.0.0-alpha.105"
36
36
  }
37
37
  }
@@ -791,7 +791,7 @@ impl NapiResourceInstanceWrapper {
791
791
  /// If `resource_id` is provided, a minimal resource metadata is created so
792
792
  /// the tile-source fast path can look up tiles by resource.
793
793
  #[napi(constructor)]
794
- pub fn new(graph_id: String, _resource_id: Option<String>) -> Result<Self> {
794
+ pub fn new(graph_id: String, resource_id: Option<String>) -> Result<Self> {
795
795
  let graph = alizarin_core::get_graph(&graph_id).ok_or_else(|| {
796
796
  napi::Error::from_reason(format!(
797
797
  "Graph '{}' not registered. Call registerGraph() first.",
@@ -800,10 +800,26 @@ impl NapiResourceInstanceWrapper {
800
800
  })?;
801
801
 
802
802
  let model_access = GraphModelAccess::from_graph(&graph);
803
- // TODO: use resource_id with new_for_resource_id once tile-source plumbing is committed
804
- let mut core = ResourceInstanceWrapperCore::new(graph_id);
803
+ let mut core = ResourceInstanceWrapperCore::new(graph_id.clone());
805
804
  core.set_cached_indices(&model_access);
806
805
 
806
+ // Set minimal resource metadata so tile source can resolve this instance.
807
+ if let Some(rid) = resource_id {
808
+ use alizarin_core::graph::{StaticResourceDescriptors, StaticResourceMetadata};
809
+ core.resource_instance = Some(StaticResourceMetadata {
810
+ resourceinstanceid: rid,
811
+ graph_id,
812
+ name: String::new(),
813
+ descriptors: StaticResourceDescriptors::default(),
814
+ publication_id: None,
815
+ principaluser_id: None,
816
+ legacyid: None,
817
+ graph_publication_id: None,
818
+ createdtime: None,
819
+ lastmodified: None,
820
+ });
821
+ }
822
+
807
823
  Ok(NapiResourceInstanceWrapper {
808
824
  inner: core,
809
825
  model_access,
package/src/lib.rs CHANGED
@@ -157,6 +157,12 @@ impl NapiStaticGraph {
157
157
  self.inner.graphid.clone()
158
158
  }
159
159
 
160
+ /// Alias matching the WASM `graphid` property for backend consistency.
161
+ #[napi(getter, js_name = "graphid")]
162
+ pub fn graphid(&self) -> String {
163
+ self.inner.graphid.clone()
164
+ }
165
+
160
166
  #[napi(getter)]
161
167
  pub fn name(&self) -> serde_json::Value {
162
168
  serde_json::to_value(&self.inner.name).unwrap_or(serde_json::Value::Null)