alizarin 0.2.1-alpha.83
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/LICENSE.txt +661 -0
- package/README.md +160 -0
- package/dist/_wasm.d.ts +23 -0
- package/dist/alizarin.full.js +799 -0
- package/dist/alizarin.full.js.map +1 -0
- package/dist/alizarin.inline-full.js +4 -0
- package/dist/alizarin.inline.js +4 -0
- package/dist/alizarin.js +47 -0
- package/dist/alizarin.js.map +1 -0
- package/dist/alizarin_bg.wasm +0 -0
- package/dist/backend.d.ts +74 -0
- package/dist/cards.d.ts +21 -0
- package/dist/client.d.ts +86 -0
- package/dist/collectionMutator.d.ts +155 -0
- package/dist/csvModelLoader.d.ts +59 -0
- package/dist/full.d.ts +3 -0
- package/dist/graphManager.d.ts +259 -0
- package/dist/interfaces.d.ts +145 -0
- package/dist/main-r-MmUiQf.js +12355 -0
- package/dist/main-r-MmUiQf.js.map +1 -0
- package/dist/main.d.ts +28 -0
- package/dist/nodeConfig.d.ts +61 -0
- package/dist/pseudos.d.ts +118 -0
- package/dist/rdm.d.ts +68 -0
- package/dist/renderers.d.ts +65 -0
- package/dist/semantic.d.ts +35 -0
- package/dist/static-types.d.ts +172 -0
- package/dist/staticStore.d.ts +60 -0
- package/dist/tracing/index.d.ts +172 -0
- package/dist/utils.d.ts +43 -0
- package/dist/validation/index.d.ts +734 -0
- package/dist/validation/index.js +1194 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/validators/graphLoading.d.ts +69 -0
- package/dist/validation/validators/index.d.ts +1 -0
- package/dist/viewModels/BooleanViewModel.d.ts +17 -0
- package/dist/viewModels/ConceptListViewModel.d.ts +15 -0
- package/dist/viewModels/ConceptValueViewModel.d.ts +28 -0
- package/dist/viewModels/DateViewModel.d.ts +16 -0
- package/dist/viewModels/DomainValueListViewModel.d.ts +15 -0
- package/dist/viewModels/DomainValueViewModel.d.ts +17 -0
- package/dist/viewModels/EDTFViewModel.d.ts +13 -0
- package/dist/viewModels/GeoJSONViewModel.d.ts +26 -0
- package/dist/viewModels/NodeViewModel.d.ts +15 -0
- package/dist/viewModels/NonLocalizedStringViewModel.d.ts +13 -0
- package/dist/viewModels/NumberViewModel.d.ts +14 -0
- package/dist/viewModels/ResourceInstanceListViewModel.d.ts +25 -0
- package/dist/viewModels/ResourceInstanceViewModel.d.ts +62 -0
- package/dist/viewModels/StringViewModel.d.ts +17 -0
- package/dist/viewModels/UrlViewModel.d.ts +22 -0
- package/dist/viewModels/cacheEntries.d.ts +73 -0
- package/dist/viewModels/getViewModel.d.ts +4 -0
- package/dist/viewModels/index.d.ts +20 -0
- package/dist/viewModels/types.d.ts +15 -0
- package/dist/viewModels.d.ts +1 -0
- package/dist/wasmTiming.d.ts +11 -0
- package/package.json +93 -0
package/dist/alizarin.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { A, K, G, p, R, o, S, L, N, c, I, J, T, k, y, Q, t, B, l, b, _, j, D, m, F, H, r, a, i, z, O, q, P, x, d, f, s, E, h, u, M, v, e, w } from "./main-r-MmUiQf.js";
|
|
2
|
+
export {
|
|
3
|
+
A as AlizarinModel,
|
|
4
|
+
K as CollectionMutator,
|
|
5
|
+
G as GraphManager,
|
|
6
|
+
p as GraphMutator,
|
|
7
|
+
R as RDM,
|
|
8
|
+
o as ResourceModelWrapper,
|
|
9
|
+
S as autoDetectBackend,
|
|
10
|
+
L as buildGraphFromModelCsvs,
|
|
11
|
+
N as buildResourcesFromBusinessCsv,
|
|
12
|
+
c as client,
|
|
13
|
+
I as collectionToSkosXml,
|
|
14
|
+
J as collectionsToSkosXml,
|
|
15
|
+
T as createResourceRegistry,
|
|
16
|
+
k as createWKRM,
|
|
17
|
+
y as ensureWasmRdmCache,
|
|
18
|
+
Q as getBackend,
|
|
19
|
+
t as getCurrentLanguage,
|
|
20
|
+
B as getTimingStats,
|
|
21
|
+
l as getWKRMClass,
|
|
22
|
+
b as graphManager,
|
|
23
|
+
_ as initWasm,
|
|
24
|
+
j as interfaces,
|
|
25
|
+
D as logTimingStats,
|
|
26
|
+
m as nodeConfig,
|
|
27
|
+
F as parseSkosXml,
|
|
28
|
+
H as parseSkosXmlToCollection,
|
|
29
|
+
r as registerExtensionHandler,
|
|
30
|
+
a as registerResolvableDatatype,
|
|
31
|
+
i as renderers,
|
|
32
|
+
z as resetTimingStats,
|
|
33
|
+
O as setBackend,
|
|
34
|
+
q as setCurrentLanguage,
|
|
35
|
+
P as setNapiModule,
|
|
36
|
+
x as setWasmURL,
|
|
37
|
+
d as slugify,
|
|
38
|
+
f as staticStore,
|
|
39
|
+
s as staticTypes,
|
|
40
|
+
E as tracing,
|
|
41
|
+
h as unregisterResolvableDatatype,
|
|
42
|
+
u as utils,
|
|
43
|
+
M as validateModelCsvs,
|
|
44
|
+
v as version,
|
|
45
|
+
e as viewModels,
|
|
46
|
+
w as wasmReady
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alizarin.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
Binary file
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend abstraction for WASM vs NAPI.
|
|
3
|
+
*
|
|
4
|
+
* When running in Node.js CLI environments (e.g., starches-builder), the NAPI
|
|
5
|
+
* backend avoids WASM linear memory limits. In browsers or when NAPI is
|
|
6
|
+
* unavailable, the WASM backend is used.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* import { setBackend, createInstanceWrapper } from './backend';
|
|
10
|
+
* setBackend('napi'); // before any wrapper creation
|
|
11
|
+
*/
|
|
12
|
+
import type { StaticResource } from "./static-types";
|
|
13
|
+
export type BackendType = 'wasm' | 'napi';
|
|
14
|
+
/**
|
|
15
|
+
* Register the loaded WASM module. Called by _wasm.ts after initialization.
|
|
16
|
+
* This avoids require() of ESM packages in factory functions.
|
|
17
|
+
*/
|
|
18
|
+
export declare function setWasmModule(mod: any): void;
|
|
19
|
+
/**
|
|
20
|
+
* Set the active backend. Must be called before creating any instance wrappers.
|
|
21
|
+
*/
|
|
22
|
+
export declare function setBackend(backend: BackendType): void;
|
|
23
|
+
export declare function getBackend(): BackendType;
|
|
24
|
+
/**
|
|
25
|
+
* Register a pre-loaded NAPI module (for when require() path resolution
|
|
26
|
+
* doesn't work, e.g., in bundled environments).
|
|
27
|
+
*/
|
|
28
|
+
export declare function setNapiModule(mod: any): void;
|
|
29
|
+
/**
|
|
30
|
+
* Create an instance wrapper for a resource.
|
|
31
|
+
* Returns either a WASMResourceInstanceWrapper or NapiResourceInstanceWrapper,
|
|
32
|
+
* both of which share the same method interface.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createInstanceWrapperForResource(resource: StaticResource): any;
|
|
35
|
+
/**
|
|
36
|
+
* Create an instance wrapper for a model (no resource data yet).
|
|
37
|
+
*/
|
|
38
|
+
export declare function createInstanceWrapperForModel(graphId: string): any;
|
|
39
|
+
/**
|
|
40
|
+
* Create a resource registry (for staticStore).
|
|
41
|
+
*/
|
|
42
|
+
export declare function createResourceRegistry(): any;
|
|
43
|
+
/**
|
|
44
|
+
* Get or create a backend-appropriate RDM cache.
|
|
45
|
+
* In WASM mode returns WasmRdmCache; in NAPI mode returns NapiRdmCache.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getRdmCache(): any;
|
|
48
|
+
/**
|
|
49
|
+
* Get or create a backend-appropriate node config manager.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getNodeConfigManager(): any;
|
|
52
|
+
/**
|
|
53
|
+
* Create a model wrapper backend (graph schema operations).
|
|
54
|
+
* Returns either a WASMResourceModelWrapper or NapiResourceModelWrapper.
|
|
55
|
+
*
|
|
56
|
+
* In WASM mode, the wkrm is passed to the constructor (WASM stores it).
|
|
57
|
+
* In NAPI mode, only the graph and defaultAllow are needed — wkrm is
|
|
58
|
+
* stored in the TS ResourceModelWrapper directly.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createResourceModelWrapper(wkrm: any, graph: any, defaultAllow: boolean): any;
|
|
61
|
+
/**
|
|
62
|
+
* Create a WKRM (Well-Known Resource Model) from graph metadata.
|
|
63
|
+
* In WASM mode uses the Rust WKRM class; in NAPI mode uses a pure TS equivalent.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createWKRM(meta: any): any;
|
|
66
|
+
/**
|
|
67
|
+
* Get the WKRM class itself (for instanceof checks or direct construction).
|
|
68
|
+
*/
|
|
69
|
+
export declare function getWKRMClass(): any;
|
|
70
|
+
/**
|
|
71
|
+
* Auto-detect the best backend for the current environment.
|
|
72
|
+
* Prefers NAPI in Node.js when available, falls back to WASM.
|
|
73
|
+
*/
|
|
74
|
+
export declare function autoDetectBackend(): BackendType;
|
package/dist/cards.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StaticNode } from "./static-types";
|
|
2
|
+
declare class CardComponent {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
constructor(id: string, name: string);
|
|
6
|
+
}
|
|
7
|
+
declare class Widget {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
datatype: string;
|
|
11
|
+
defaultConfig: string;
|
|
12
|
+
constructor(id: string, name: string, datatype: string, defaultConfig: string);
|
|
13
|
+
getDefaultConfig(): {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare const DEFAULT_CARD_COMPONENT: CardComponent;
|
|
18
|
+
declare function getDefaultWidgetForNode(node: StaticNode, preferences?: {
|
|
19
|
+
[key: string]: string;
|
|
20
|
+
}): Widget;
|
|
21
|
+
export { DEFAULT_CARD_COMPONENT, CardComponent, getDefaultWidgetForNode, Widget };
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { StaticGraphMeta, StaticGraph, StaticResource, StaticResourceSummary, StaticResourceRegistry, StaticTile } from "./static-types";
|
|
2
|
+
import { StaticCollection } from "./rdm";
|
|
3
|
+
declare class GraphResult {
|
|
4
|
+
models: {
|
|
5
|
+
[graphId: string]: StaticGraphMeta;
|
|
6
|
+
};
|
|
7
|
+
constructor(jsonData: GraphResult);
|
|
8
|
+
}
|
|
9
|
+
declare abstract class ArchesClient {
|
|
10
|
+
registry: StaticResourceRegistry | null;
|
|
11
|
+
abstract getGraphs(): Promise<GraphResult>;
|
|
12
|
+
abstract getGraph(graph: StaticGraphMeta): Promise<StaticGraph | null>;
|
|
13
|
+
abstract getGraphByIdOnly(graphId: string): Promise<StaticGraph | null>;
|
|
14
|
+
abstract getResources(graphId: string, limit: number, reloadIfSeen: boolean): Promise<StaticResource[]>;
|
|
15
|
+
abstract getResource(resourceId: string): Promise<StaticResource>;
|
|
16
|
+
abstract getCollection(collectionId: string): Promise<StaticCollection>;
|
|
17
|
+
abstract getResourceSummaries(graphId: string, limit: number): Promise<StaticResourceSummary[]>;
|
|
18
|
+
abstract getResourceTiles(resourceId: string): Promise<StaticTile[]>;
|
|
19
|
+
}
|
|
20
|
+
declare class ArchesClientRemote extends ArchesClient {
|
|
21
|
+
archesUrl: string;
|
|
22
|
+
constructor(archesUrl: string);
|
|
23
|
+
getGraphs(): Promise<GraphResult>;
|
|
24
|
+
getGraph(graph: StaticGraphMeta): Promise<StaticGraph>;
|
|
25
|
+
getGraphByIdOnly(graphId: string): Promise<StaticGraph>;
|
|
26
|
+
getResource(resourceId: string): Promise<StaticResource>;
|
|
27
|
+
getCollection(collectionId: string): Promise<StaticCollection>;
|
|
28
|
+
getResources(graphId: string, limit: number, _reloadIfSeen: boolean): Promise<StaticResource[]>;
|
|
29
|
+
getResourceSummaries(graphId: string, limit: number): Promise<StaticResourceSummary[]>;
|
|
30
|
+
getResourceTiles(resourceId: string): Promise<StaticTile[]>;
|
|
31
|
+
}
|
|
32
|
+
declare class ArchesClientRemoteStatic extends ArchesClient {
|
|
33
|
+
archesUrl: string;
|
|
34
|
+
allGraphFile: () => string;
|
|
35
|
+
graphToGraphFile?: (graph: StaticGraphMeta) => string;
|
|
36
|
+
graphIdToGraphFile: (graphId: string) => string;
|
|
37
|
+
graphIdToResourcesFiles: ((graphId: string) => string[]) | ((graphId: string) => Promise<string[]>) | ((graphId: string) => AsyncGenerator<string>);
|
|
38
|
+
resourceIdToFile: (resourceId: string) => string;
|
|
39
|
+
collectionIdToFile: (collectionId: string) => string;
|
|
40
|
+
constructor(archesUrl: string, { allGraphFile, graphToGraphFile, graphIdToResourcesFiles, resourceIdToFile, collectionIdToFile, graphIdToGraphFile, }?: {
|
|
41
|
+
allGraphFile?: () => string;
|
|
42
|
+
graphToGraphFile?: (graph: StaticGraphMeta) => string;
|
|
43
|
+
graphIdToGraphFile?: (graphId: string) => string;
|
|
44
|
+
graphIdToResourcesFiles?: ((graphId: string) => string[]) | ((graphId: string) => Promise<string[]>) | ((graphId: string) => AsyncGenerator<string>);
|
|
45
|
+
resourceIdToFile?: (resourceId: string) => string;
|
|
46
|
+
collectionIdToFile?: (collectionId: string) => string;
|
|
47
|
+
});
|
|
48
|
+
getGraphs(): Promise<GraphResult>;
|
|
49
|
+
getGraph(graph: StaticGraphMeta): Promise<StaticGraph | null>;
|
|
50
|
+
getGraphByIdOnly(graphId: string): Promise<StaticGraph | null>;
|
|
51
|
+
getResource(resourceId: string): Promise<StaticResource>;
|
|
52
|
+
getCollection(collectionId: string): Promise<StaticCollection>;
|
|
53
|
+
getResources(graphId: string, limit: number, _reloadIfSeen: boolean): Promise<StaticResource[]>;
|
|
54
|
+
getResourceSummaries(graphId: string, limit: number): Promise<StaticResourceSummary[]>;
|
|
55
|
+
getResourceTiles(resourceId: string): Promise<StaticTile[]>;
|
|
56
|
+
}
|
|
57
|
+
declare class ArchesClientLocal extends ArchesClient {
|
|
58
|
+
allGraphFile: () => string;
|
|
59
|
+
graphToGraphFile?: (graph: StaticGraphMeta) => string;
|
|
60
|
+
graphIdToGraphFile: (graphId: string) => string;
|
|
61
|
+
graphIdToResourcesFiles: ((graphId: string) => string[]) | ((graphId: string) => Promise<string[]>) | ((graphId: string) => AsyncGenerator<string>);
|
|
62
|
+
resourceIdToFile: (resourceId: string) => string;
|
|
63
|
+
collectionIdToFile: (collectionId: string) => string;
|
|
64
|
+
__loadedFileCache: {
|
|
65
|
+
[graphId: string]: string[];
|
|
66
|
+
};
|
|
67
|
+
private ensureFs;
|
|
68
|
+
constructor({ allGraphFile, graphToGraphFile, graphIdToResourcesFiles, resourceIdToFile, collectionIdToFile, graphIdToGraphFile, }?: {
|
|
69
|
+
allGraphFile?: () => string;
|
|
70
|
+
graphToGraphFile?: (graph: StaticGraphMeta) => string;
|
|
71
|
+
graphIdToGraphFile?: (graphId: string) => string;
|
|
72
|
+
graphIdToResourcesFiles?: ((graphId: string) => string[]) | ((graphId: string) => Promise<string[]>) | ((graphId: string) => AsyncGenerator<string>);
|
|
73
|
+
resourceIdToFile?: (resourceId: string) => string;
|
|
74
|
+
collectionIdToFile?: (collectionId: string) => string;
|
|
75
|
+
});
|
|
76
|
+
getGraphs(): Promise<GraphResult>;
|
|
77
|
+
getGraph(graph: StaticGraphMeta): Promise<StaticGraph | null>;
|
|
78
|
+
getGraphByIdOnly(graphId: string): Promise<StaticGraph | null>;
|
|
79
|
+
getResource(resourceId: string): Promise<StaticResource>;
|
|
80
|
+
getCollection(collectionId: string): Promise<StaticCollection>;
|
|
81
|
+
getResources(graphId: string, limit: number | null, reloadIfSeen: boolean): Promise<StaticResource[]>;
|
|
82
|
+
getResourceSummaries(graphId: string, limit: number): Promise<StaticResourceSummary[]>;
|
|
83
|
+
getResourceTiles(resourceId: string): Promise<StaticTile[]>;
|
|
84
|
+
}
|
|
85
|
+
declare const archesClient: ArchesClientRemote;
|
|
86
|
+
export { archesClient, ArchesClient, ArchesClientRemoteStatic, ArchesClientRemote, ArchesClientLocal, GraphResult, };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { StaticCollection, StaticConcept, SkosNodeType } from './static-types';
|
|
2
|
+
/**
|
|
3
|
+
* Options for adding a concept to a collection
|
|
4
|
+
*/
|
|
5
|
+
export interface AddConceptOptions {
|
|
6
|
+
/** The label value (string) or multilingual labels */
|
|
7
|
+
label: string | {
|
|
8
|
+
[lang: string]: string;
|
|
9
|
+
};
|
|
10
|
+
/** Optional parent concept ID to add this as a child */
|
|
11
|
+
parentId?: string;
|
|
12
|
+
/** Optional source/identifier URI */
|
|
13
|
+
source?: string;
|
|
14
|
+
/** Optional sort order */
|
|
15
|
+
sortOrder?: number;
|
|
16
|
+
/** Optional explicit ID (otherwise generated from label) */
|
|
17
|
+
id?: string;
|
|
18
|
+
/** Optional URI for the concept */
|
|
19
|
+
uri?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Result of adding a concept
|
|
23
|
+
*/
|
|
24
|
+
export interface AddConceptResult {
|
|
25
|
+
concept: StaticConcept;
|
|
26
|
+
id: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Mutator class for StaticCollection that provides methods for adding,
|
|
30
|
+
* modifying, and removing concepts including nested children.
|
|
31
|
+
*/
|
|
32
|
+
export declare class CollectionMutator {
|
|
33
|
+
private collection;
|
|
34
|
+
constructor(collection: StaticCollection);
|
|
35
|
+
/**
|
|
36
|
+
* Get the underlying collection
|
|
37
|
+
*/
|
|
38
|
+
getCollection(): StaticCollection;
|
|
39
|
+
/**
|
|
40
|
+
* Create a new empty collection with a mutator.
|
|
41
|
+
*
|
|
42
|
+
* @param name - Collection name (string or multilingual object)
|
|
43
|
+
* @param options - Optional settings
|
|
44
|
+
* @param options.collectionId - Explicit ID (otherwise generated from name)
|
|
45
|
+
* @param options.nodeType - 'ConceptScheme' (default) or 'Collection' for Arches-compatible
|
|
46
|
+
* @param options.uri - Optional URI for the collection
|
|
47
|
+
*
|
|
48
|
+
* Both types support hierarchical concepts via narrower/broader relationships.
|
|
49
|
+
* The difference is how membership is expressed in RDF:
|
|
50
|
+
* - ConceptScheme: uses skos:inScheme on concepts
|
|
51
|
+
* - Collection: uses skos:member to list all concepts (including children)
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* // Create a hierarchical ConceptScheme (default)
|
|
55
|
+
* const scheme = CollectionMutator.createEmpty("Categories");
|
|
56
|
+
* scheme.addConcept({ label: "Parent" });
|
|
57
|
+
* scheme.addChildConcept(parentId, { label: "Child" }); // narrower/broader
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // Create an Arches-compatible Collection with hierarchy
|
|
61
|
+
* const collection = CollectionMutator.createEmpty("My Collection", { nodeType: 'Collection' });
|
|
62
|
+
* const parent = collection.addConcept({ label: "Parent" });
|
|
63
|
+
* collection.addChildConcept(parent.id, { label: "Child" }); // narrower/broader, all listed as members
|
|
64
|
+
*/
|
|
65
|
+
static createEmpty(name: string | {
|
|
66
|
+
[lang: string]: string;
|
|
67
|
+
}, options?: string | {
|
|
68
|
+
collectionId?: string;
|
|
69
|
+
nodeType?: SkosNodeType;
|
|
70
|
+
uri?: string;
|
|
71
|
+
}): CollectionMutator;
|
|
72
|
+
/**
|
|
73
|
+
* Create a new Arches-compatible Collection.
|
|
74
|
+
* Convenience method equivalent to createEmpty(name, { nodeType: 'Collection' })
|
|
75
|
+
* Collections can have hierarchical concepts (narrower/broader) but list all
|
|
76
|
+
* concepts (including children) as members via skos:member.
|
|
77
|
+
*/
|
|
78
|
+
static createArchesCollection(name: string | {
|
|
79
|
+
[lang: string]: string;
|
|
80
|
+
}, options?: {
|
|
81
|
+
collectionId?: string;
|
|
82
|
+
uri?: string;
|
|
83
|
+
}): CollectionMutator;
|
|
84
|
+
/**
|
|
85
|
+
* Add a top-level concept to the collection.
|
|
86
|
+
* Use parentId to create hierarchy (narrower/broader relationships on concepts).
|
|
87
|
+
*/
|
|
88
|
+
addConcept(options: AddConceptOptions): AddConceptResult;
|
|
89
|
+
/**
|
|
90
|
+
* Add a top-level member concept (alias for addConcept).
|
|
91
|
+
* Useful when working with Collections to make intent clear.
|
|
92
|
+
* Use addChildConcept() to create hierarchical concepts.
|
|
93
|
+
*/
|
|
94
|
+
addMember(options: Omit<AddConceptOptions, 'parentId'>): AddConceptResult;
|
|
95
|
+
/**
|
|
96
|
+
* Add a child concept under an existing concept.
|
|
97
|
+
* For both ConceptScheme and Collection types, this creates a narrower/broader hierarchy
|
|
98
|
+
* on the concepts. Collections list all concepts (including children) as members.
|
|
99
|
+
*/
|
|
100
|
+
addChildConcept(parentId: string, options: Omit<AddConceptOptions, 'parentId'>): AddConceptResult;
|
|
101
|
+
/**
|
|
102
|
+
* Add multiple concepts at once, supporting nested structure
|
|
103
|
+
* @param concepts Array of concepts with optional children
|
|
104
|
+
* @param parentId Optional parent ID to add all concepts under
|
|
105
|
+
*/
|
|
106
|
+
addConcepts(concepts: Array<AddConceptOptions & {
|
|
107
|
+
children?: Array<AddConceptOptions & {
|
|
108
|
+
children?: any[];
|
|
109
|
+
}>;
|
|
110
|
+
}>, parentId?: string): AddConceptResult[];
|
|
111
|
+
/**
|
|
112
|
+
* Remove a concept by ID (and all its children)
|
|
113
|
+
*/
|
|
114
|
+
removeConcept(conceptId: string): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Move a concept to a new parent (or to top level if parentId is null)
|
|
117
|
+
*/
|
|
118
|
+
moveConcept(conceptId: string, newParentId: string | null): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Update a concept's properties
|
|
121
|
+
*/
|
|
122
|
+
updateConcept(conceptId: string, updates: Partial<Omit<AddConceptOptions, 'id' | 'parentId'>>): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Get a concept by ID
|
|
125
|
+
*/
|
|
126
|
+
getConcept(conceptId: string): StaticConcept | null;
|
|
127
|
+
/**
|
|
128
|
+
* Get all concept IDs in the collection (including nested)
|
|
129
|
+
*/
|
|
130
|
+
getAllConceptIds(): string[];
|
|
131
|
+
/**
|
|
132
|
+
* Get the path from root to a concept (list of concept IDs)
|
|
133
|
+
*/
|
|
134
|
+
getConceptPath(conceptId: string): string[] | null;
|
|
135
|
+
/**
|
|
136
|
+
* Create a concept object from options
|
|
137
|
+
*/
|
|
138
|
+
private _createConcept;
|
|
139
|
+
/**
|
|
140
|
+
* Find a concept by ID in the entire tree
|
|
141
|
+
*/
|
|
142
|
+
private _findConcept;
|
|
143
|
+
/**
|
|
144
|
+
* Index a concept and its children in __allConcepts and __values
|
|
145
|
+
*/
|
|
146
|
+
private _indexConcept;
|
|
147
|
+
/**
|
|
148
|
+
* Remove a concept and its children from indexes
|
|
149
|
+
*/
|
|
150
|
+
private _unindexConcept;
|
|
151
|
+
/**
|
|
152
|
+
* Remove a concept from a parent's children list
|
|
153
|
+
*/
|
|
154
|
+
private _removeFromChildren;
|
|
155
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSV Model Loader
|
|
3
|
+
*
|
|
4
|
+
* Thin TypeScript wrapper over the WASM `buildGraphFromModelCsvs` and
|
|
5
|
+
* `validateModelCsvs` functions. Parses the 3-CSV format (graph.csv,
|
|
6
|
+
* nodes.csv, collections.csv) and builds an Arches resource model graph
|
|
7
|
+
* with SKOS collections.
|
|
8
|
+
*
|
|
9
|
+
* @module csvModelLoader
|
|
10
|
+
*/
|
|
11
|
+
export interface CsvModelDiagnostic {
|
|
12
|
+
level: 'Error' | 'Warning';
|
|
13
|
+
file: string;
|
|
14
|
+
line: number | null;
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CsvModelBuildResult {
|
|
18
|
+
graph: any;
|
|
19
|
+
collections: any[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Build a graph and collections from the 3-CSV model format.
|
|
23
|
+
*
|
|
24
|
+
* @param graphCsv - Contents of graph.csv
|
|
25
|
+
* @param nodesCsv - Contents of nodes.csv
|
|
26
|
+
* @param rdmNamespace - RDM namespace string (UUID or URL) for deterministic ID generation
|
|
27
|
+
* @param collectionsCsv - Contents of collections.csv (optional)
|
|
28
|
+
* @returns The built graph and collections
|
|
29
|
+
* @throws Error with diagnostics if validation or build fails
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildGraphFromModelCsvs(graphCsv: string, nodesCsv: string, rdmNamespace: string, collectionsCsv?: string): CsvModelBuildResult;
|
|
32
|
+
/**
|
|
33
|
+
* Validate 3-CSV model files without building.
|
|
34
|
+
*
|
|
35
|
+
* @param graphCsv - Contents of graph.csv
|
|
36
|
+
* @param nodesCsv - Contents of nodes.csv
|
|
37
|
+
* @param collectionsCsv - Contents of collections.csv (optional)
|
|
38
|
+
* @returns Array of diagnostics (errors and warnings)
|
|
39
|
+
*/
|
|
40
|
+
export declare function validateModelCsvs(graphCsv: string, nodesCsv: string, collectionsCsv?: string): CsvModelDiagnostic[];
|
|
41
|
+
export interface BusinessDataResult {
|
|
42
|
+
business_data: {
|
|
43
|
+
resources: any[];
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Build resource instances from a business data CSV.
|
|
48
|
+
*
|
|
49
|
+
* Columns are node aliases (not UUIDs). Concept values are labels
|
|
50
|
+
* resolved against the collections. ResourceIDs generate deterministic UUIDs.
|
|
51
|
+
*
|
|
52
|
+
* @param csvData - Business data CSV with ResourceID as first column
|
|
53
|
+
* @param graph - Built graph JSON (from buildGraphFromModelCsvs)
|
|
54
|
+
* @param collections - Built collections array (from buildGraphFromModelCsvs)
|
|
55
|
+
* @param defaultLanguage - Default language code (default "en")
|
|
56
|
+
* @param strictConcepts - Error on unresolved concept labels (default true)
|
|
57
|
+
* @returns Business data wrapper with resources array
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildResourcesFromBusinessCsv(csvData: string, graph: any, collections: any[], defaultLanguage?: string, strictConcepts?: boolean): BusinessDataResult;
|
package/dist/full.d.ts
ADDED