@alizarin/napi 0.2.1-alpha.84 → 0.2.1-alpha.85
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/{alizarin-napi-0.2.1-alpha.84.tgz → alizarin-napi-0.2.1-alpha.85.tgz} +0 -0
- package/alizarin-napi.darwin-arm64.node +0 -0
- package/alizarin-napi.darwin-x64.node +0 -0
- package/alizarin-napi.linux-x64-gnu.node +0 -0
- package/alizarin-napi.win32-x64-msvc.node +0 -0
- package/index.d.ts +17 -20
- package/index.js +2 -2
- package/package.json +4 -4
- package/src/instance_wrapper_napi.rs +13 -8
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -40,6 +40,17 @@ export declare function extensionResolveMarkers(datatype: string, tileData: any,
|
|
|
40
40
|
export declare function hasExtensionHandler(datatype: string): boolean
|
|
41
41
|
/** List all registered extension handler datatypes. */
|
|
42
42
|
export declare function getRegisteredExtensionHandlers(): Array<string>
|
|
43
|
+
/**
|
|
44
|
+
* Import a prebuild/pkg directory: register graphs, load SKOS collections,
|
|
45
|
+
* and load ontology configs.
|
|
46
|
+
*
|
|
47
|
+
* 1. Loads and registers all graphs from graphs/resource_models/ and graphs/branches/
|
|
48
|
+
* 2. Parses SKOS XML from reference_data/collections/ into the global RDM cache
|
|
49
|
+
* 3. Loads ontology configs from ontologies/ (if present)
|
|
50
|
+
*
|
|
51
|
+
* Returns `{ graphIds, collectionIds, collections, ontologyConfigs }`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function importPrebuild(prebuildDir: string, baseUri: string): any
|
|
43
54
|
export declare class NapiRdmCache {
|
|
44
55
|
constructor()
|
|
45
56
|
/** Load collections from a SKOS JSON string. */
|
|
@@ -160,8 +171,12 @@ export declare class NapiResourceInstanceWrapper {
|
|
|
160
171
|
valuesFromResourceNodegroup(existingValuesJs: any, nodegroupTileIds: Array<string>, nodegroupId: string): NapiValuesFromNodegroupResult
|
|
161
172
|
/** Resolve a dot-separated path and return a PseudoList. */
|
|
162
173
|
getValuesAtPath(path: string): NapiPseudoList
|
|
163
|
-
/**
|
|
164
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Get semantic child value for a parent/child relationship.
|
|
176
|
+
* Returns a NapiPseudoList (or null for empty). Singles are wrapped in a
|
|
177
|
+
* single-element list so the JS `wrapRustPseudo` path works uniformly.
|
|
178
|
+
*/
|
|
179
|
+
getSemanticChildValue(parentTileId: string | undefined | null, parentNodeId: string, parentNodegroupId: string | undefined | null, childAlias: string): NapiPseudoList | null
|
|
165
180
|
/** Get all semantic child values for a parent node. */
|
|
166
181
|
getAllSemanticChildValues(parentTileId: string | undefined | null, parentNodeId: string, parentNodegroupId?: string | undefined | null): any
|
|
167
182
|
/** Find all semantic children of a parent node (returns map of alias → tile IDs). */
|
|
@@ -247,24 +262,6 @@ export declare class NapiResourceModelWrapper {
|
|
|
247
262
|
/** Prune graph to only include permitted nodegroups and their dependencies. */
|
|
248
263
|
pruneGraph(keepFunctions?: Array<string> | undefined | null): void
|
|
249
264
|
}
|
|
250
|
-
export declare class NapiPrebuildLoader {
|
|
251
|
-
constructor(path: string)
|
|
252
|
-
/** Load a single graph from a JSON file path (relative to prebuild root or absolute). */
|
|
253
|
-
loadGraph(path: string): NapiStaticGraph
|
|
254
|
-
/** Load all graphs from prebuild/graphs/resource_models/ */
|
|
255
|
-
loadAllGraphs(): Array<NapiStaticGraph>
|
|
256
|
-
/**
|
|
257
|
-
* Load full resources (with tiles) from a single business data file,
|
|
258
|
-
* filtered by graph ID.
|
|
259
|
-
*/
|
|
260
|
-
loadFullResourcesFromFile(path: string, graphId: string): any
|
|
261
|
-
/** Find all business data JSON files in the prebuild directory. */
|
|
262
|
-
findBusinessDataFiles(): Array<string>
|
|
263
|
-
/** Get prebuild directory info. */
|
|
264
|
-
getInfo(): any
|
|
265
|
-
/** Count resources for a given graph ID. */
|
|
266
|
-
countResourcesForGraph(graphId: string): number
|
|
267
|
-
}
|
|
268
265
|
export declare class NapiPrebuildExporter {
|
|
269
266
|
constructor()
|
|
270
267
|
/**
|
package/index.js
CHANGED
|
@@ -310,7 +310,7 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { NapiRdmCache, NapiNodeConfigManager, NapiPseudoValue, NapiPseudoList, NapiPopulateResult, NapiEnsureNodegroupResult, NapiValuesFromNodegroupResult, NapiResourceInstanceWrapper, NapiResourceModelWrapper,
|
|
313
|
+
const { NapiRdmCache, NapiNodeConfigManager, NapiPseudoValue, NapiPseudoList, NapiPopulateResult, NapiEnsureNodegroupResult, NapiValuesFromNodegroupResult, NapiResourceInstanceWrapper, NapiResourceModelWrapper, NapiPrebuildExporter, NapiStaticGraph, NapiStaticResourceRegistry, buildGraphFromCsvs, buildBusinessDataFromCsv, extensionCoerce, extensionRenderDisplay, extensionResolveMarkers, hasExtensionHandler, getRegisteredExtensionHandlers, importPrebuild } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.NapiRdmCache = NapiRdmCache
|
|
316
316
|
module.exports.NapiNodeConfigManager = NapiNodeConfigManager
|
|
@@ -321,7 +321,6 @@ module.exports.NapiEnsureNodegroupResult = NapiEnsureNodegroupResult
|
|
|
321
321
|
module.exports.NapiValuesFromNodegroupResult = NapiValuesFromNodegroupResult
|
|
322
322
|
module.exports.NapiResourceInstanceWrapper = NapiResourceInstanceWrapper
|
|
323
323
|
module.exports.NapiResourceModelWrapper = NapiResourceModelWrapper
|
|
324
|
-
module.exports.NapiPrebuildLoader = NapiPrebuildLoader
|
|
325
324
|
module.exports.NapiPrebuildExporter = NapiPrebuildExporter
|
|
326
325
|
module.exports.NapiStaticGraph = NapiStaticGraph
|
|
327
326
|
module.exports.NapiStaticResourceRegistry = NapiStaticResourceRegistry
|
|
@@ -332,3 +331,4 @@ module.exports.extensionRenderDisplay = extensionRenderDisplay
|
|
|
332
331
|
module.exports.extensionResolveMarkers = extensionResolveMarkers
|
|
333
332
|
module.exports.hasExtensionHandler = hasExtensionHandler
|
|
334
333
|
module.exports.getRegisteredExtensionHandlers = getRegisteredExtensionHandlers
|
|
334
|
+
module.exports.importPrebuild = importPrebuild
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alizarin/napi",
|
|
3
|
-
"version": "0.2.1-alpha.
|
|
3
|
+
"version": "0.2.1-alpha.85",
|
|
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": "0.2.1-alpha.
|
|
34
|
-
"@alizarin/napi-darwin-x64": "0.2.1-alpha.
|
|
35
|
-
"@alizarin/napi-linux-x64-gnu": "0.2.1-alpha.
|
|
33
|
+
"@alizarin/napi-win32-x64-msvc": "0.2.1-alpha.85",
|
|
34
|
+
"@alizarin/napi-darwin-x64": "0.2.1-alpha.85",
|
|
35
|
+
"@alizarin/napi-linux-x64-gnu": "0.2.1-alpha.85"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -906,6 +906,8 @@ impl NapiResourceInstanceWrapper {
|
|
|
906
906
|
// =========================================================================
|
|
907
907
|
|
|
908
908
|
/// Get semantic child value for a parent/child relationship.
|
|
909
|
+
/// Returns a NapiPseudoList (or null for empty). Singles are wrapped in a
|
|
910
|
+
/// single-element list so the JS `wrapRustPseudo` path works uniformly.
|
|
909
911
|
#[napi]
|
|
910
912
|
pub fn get_semantic_child_value(
|
|
911
913
|
&self,
|
|
@@ -913,7 +915,7 @@ impl NapiResourceInstanceWrapper {
|
|
|
913
915
|
parent_node_id: String,
|
|
914
916
|
parent_nodegroup_id: Option<String>,
|
|
915
917
|
child_alias: String,
|
|
916
|
-
) -> Result<
|
|
918
|
+
) -> Result<Option<NapiPseudoList>> {
|
|
917
919
|
let result = self
|
|
918
920
|
.inner
|
|
919
921
|
.get_semantic_child_value(
|
|
@@ -926,15 +928,18 @@ impl NapiResourceInstanceWrapper {
|
|
|
926
928
|
.map_err(sc_err)?;
|
|
927
929
|
|
|
928
930
|
match result {
|
|
929
|
-
SemanticChildResult::List(list) => {
|
|
930
|
-
Ok(serde_json::to_value(NapiPseudoListJson::from(&list))
|
|
931
|
-
.unwrap_or(serde_json::Value::Null))
|
|
932
|
-
}
|
|
931
|
+
SemanticChildResult::List(list) => Ok(Some(NapiPseudoList { inner: list })),
|
|
933
932
|
SemanticChildResult::Single(val) => {
|
|
934
|
-
|
|
935
|
-
|
|
933
|
+
// Wrap single value in a PseudoListCore so JS sees a uniform interface
|
|
934
|
+
let list = alizarin_core::PseudoListCore {
|
|
935
|
+
node_alias: val.node.alias.clone().unwrap_or_default(),
|
|
936
|
+
is_single: true,
|
|
937
|
+
is_loaded: true,
|
|
938
|
+
values: vec![val],
|
|
939
|
+
};
|
|
940
|
+
Ok(Some(NapiPseudoList { inner: list }))
|
|
936
941
|
}
|
|
937
|
-
SemanticChildResult::Empty => Ok(
|
|
942
|
+
SemanticChildResult::Empty => Ok(None),
|
|
938
943
|
}
|
|
939
944
|
}
|
|
940
945
|
|