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.
Files changed (57) hide show
  1. package/LICENSE.txt +661 -0
  2. package/README.md +160 -0
  3. package/dist/_wasm.d.ts +23 -0
  4. package/dist/alizarin.full.js +799 -0
  5. package/dist/alizarin.full.js.map +1 -0
  6. package/dist/alizarin.inline-full.js +4 -0
  7. package/dist/alizarin.inline.js +4 -0
  8. package/dist/alizarin.js +47 -0
  9. package/dist/alizarin.js.map +1 -0
  10. package/dist/alizarin_bg.wasm +0 -0
  11. package/dist/backend.d.ts +74 -0
  12. package/dist/cards.d.ts +21 -0
  13. package/dist/client.d.ts +86 -0
  14. package/dist/collectionMutator.d.ts +155 -0
  15. package/dist/csvModelLoader.d.ts +59 -0
  16. package/dist/full.d.ts +3 -0
  17. package/dist/graphManager.d.ts +259 -0
  18. package/dist/interfaces.d.ts +145 -0
  19. package/dist/main-r-MmUiQf.js +12355 -0
  20. package/dist/main-r-MmUiQf.js.map +1 -0
  21. package/dist/main.d.ts +28 -0
  22. package/dist/nodeConfig.d.ts +61 -0
  23. package/dist/pseudos.d.ts +118 -0
  24. package/dist/rdm.d.ts +68 -0
  25. package/dist/renderers.d.ts +65 -0
  26. package/dist/semantic.d.ts +35 -0
  27. package/dist/static-types.d.ts +172 -0
  28. package/dist/staticStore.d.ts +60 -0
  29. package/dist/tracing/index.d.ts +172 -0
  30. package/dist/utils.d.ts +43 -0
  31. package/dist/validation/index.d.ts +734 -0
  32. package/dist/validation/index.js +1194 -0
  33. package/dist/validation/index.js.map +1 -0
  34. package/dist/validation/validators/graphLoading.d.ts +69 -0
  35. package/dist/validation/validators/index.d.ts +1 -0
  36. package/dist/viewModels/BooleanViewModel.d.ts +17 -0
  37. package/dist/viewModels/ConceptListViewModel.d.ts +15 -0
  38. package/dist/viewModels/ConceptValueViewModel.d.ts +28 -0
  39. package/dist/viewModels/DateViewModel.d.ts +16 -0
  40. package/dist/viewModels/DomainValueListViewModel.d.ts +15 -0
  41. package/dist/viewModels/DomainValueViewModel.d.ts +17 -0
  42. package/dist/viewModels/EDTFViewModel.d.ts +13 -0
  43. package/dist/viewModels/GeoJSONViewModel.d.ts +26 -0
  44. package/dist/viewModels/NodeViewModel.d.ts +15 -0
  45. package/dist/viewModels/NonLocalizedStringViewModel.d.ts +13 -0
  46. package/dist/viewModels/NumberViewModel.d.ts +14 -0
  47. package/dist/viewModels/ResourceInstanceListViewModel.d.ts +25 -0
  48. package/dist/viewModels/ResourceInstanceViewModel.d.ts +62 -0
  49. package/dist/viewModels/StringViewModel.d.ts +17 -0
  50. package/dist/viewModels/UrlViewModel.d.ts +22 -0
  51. package/dist/viewModels/cacheEntries.d.ts +73 -0
  52. package/dist/viewModels/getViewModel.d.ts +4 -0
  53. package/dist/viewModels/index.d.ts +20 -0
  54. package/dist/viewModels/types.d.ts +15 -0
  55. package/dist/viewModels.d.ts +1 -0
  56. package/dist/wasmTiming.d.ts +11 -0
  57. package/package.json +93 -0
package/dist/main.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ import * as client from "./client";
2
+ import * as interfaces from "./interfaces";
3
+ import { RDM, ResolveLabelsOptions, registerResolvableDatatype, unregisterResolvableDatatype } from "./rdm";
4
+ import { ResourceModelWrapper, createWKRM, getWKRMClass, graphManager, staticStore, GraphManager, GraphMutator } from "./graphManager";
5
+ import * as staticTypes from "./static-types";
6
+ import { CollectionMutator } from "./collectionMutator";
7
+ import { buildGraphFromModelCsvs, validateModelCsvs, buildResourcesFromBusinessCsv } from "./csvModelLoader";
8
+ import type { CsvModelDiagnostic, CsvModelBuildResult, BusinessDataResult } from "./csvModelLoader";
9
+ import * as utils from "./utils";
10
+ import * as viewModels from "./viewModels";
11
+ import * as renderers from "./renderers";
12
+ import * as nodeConfig from "./nodeConfig";
13
+ import { setWasmURL, ensureWasmRdmCache, parseSkosXml, parseSkosXmlToCollection, collectionToSkosXml, collectionsToSkosXml, registerExtensionHandler } from "./_wasm";
14
+ import { setBackend, setNapiModule, getBackend, autoDetectBackend, createResourceRegistry } from "./backend";
15
+ import type { BackendType } from "./backend";
16
+ import { resetTimingStats, getTimingStats, logTimingStats } from "./semantic";
17
+ import * as tracing from "./tracing";
18
+ import { IStringKeyedObject } from "./interfaces";
19
+ export declare const version: string;
20
+ declare const wasmReady: Promise<void>;
21
+ declare const _wrappedInitWasm: () => Promise<void>;
22
+ declare const AlizarinModel: typeof viewModels.ResourceInstanceViewModel;
23
+ declare const setCurrentLanguage: typeof utils.setCurrentLanguage;
24
+ declare const getCurrentLanguage: typeof utils.getCurrentLanguage;
25
+ declare const slugify: typeof utils.slugify;
26
+ export type { IStringKeyedObject, ResolveLabelsOptions, CsvModelDiagnostic, CsvModelBuildResult, BusinessDataResult, };
27
+ export { AlizarinModel, client, graphManager, GraphManager, staticTypes, utils, slugify, viewModels, staticStore, RDM, registerResolvableDatatype, unregisterResolvableDatatype, renderers, interfaces, createWKRM, getWKRMClass, nodeConfig, ResourceModelWrapper, GraphMutator, setCurrentLanguage, getCurrentLanguage, _wrappedInitWasm as initWasm, setWasmURL, wasmReady, ensureWasmRdmCache, resetTimingStats, getTimingStats, logTimingStats, tracing, parseSkosXml, parseSkosXmlToCollection, collectionToSkosXml, collectionsToSkosXml, CollectionMutator, buildGraphFromModelCsvs, validateModelCsvs, buildResourcesFromBusinessCsv, registerExtensionHandler, setBackend, setNapiModule, getBackend, autoDetectBackend, createResourceRegistry, };
28
+ export type { BackendType };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Node configuration management.
3
+ *
4
+ * TypeScript wrappers around the Rust/WASM NodeConfigManager.
5
+ * Config parsing and storage is done in Rust, shared with Python bindings.
6
+ */
7
+ import { INodeConfig } from './interfaces';
8
+ import { StaticNode, StaticDomainValue, StaticGraph } from './static-types';
9
+ import { WasmNodeConfigBoolean, WasmNodeConfigConcept, WasmNodeConfigDomain, WasmNodeConfigReference } from '../pkg/alizarin';
10
+ declare class StaticNodeConfigBoolean implements INodeConfig {
11
+ private _wasm;
12
+ constructor(wasmConfig: WasmNodeConfigBoolean);
13
+ get i18n_properties(): string[];
14
+ get falseLabel(): {
15
+ [key: string]: string;
16
+ };
17
+ get trueLabel(): {
18
+ [key: string]: string;
19
+ };
20
+ getLabel(value: boolean, language: string): string | undefined;
21
+ }
22
+ declare class StaticNodeConfigConcept implements INodeConfig {
23
+ private _wasm;
24
+ constructor(wasmConfig: WasmNodeConfigConcept);
25
+ get rdmCollection(): string;
26
+ }
27
+ declare class StaticNodeConfigReference implements INodeConfig {
28
+ private _wasm;
29
+ constructor(wasmConfig: WasmNodeConfigReference);
30
+ get controlledList(): string;
31
+ get rdmCollection(): string;
32
+ get multiValue(): boolean;
33
+ getCollectionId(): string | undefined;
34
+ }
35
+ declare class StaticNodeConfigDomain implements INodeConfig {
36
+ private _wasm;
37
+ private _optionsCache;
38
+ constructor(wasmConfig: WasmNodeConfigDomain);
39
+ get i18n_config(): {
40
+ [key: string]: string;
41
+ };
42
+ get options(): StaticDomainValue[];
43
+ getSelected(): StaticDomainValue | undefined;
44
+ valueFromId(id: string): StaticDomainValue | undefined;
45
+ }
46
+ type NodeConfigType = StaticNodeConfigBoolean | StaticNodeConfigConcept | StaticNodeConfigDomain | StaticNodeConfigReference;
47
+ declare class NodeConfigManager {
48
+ private _backendManager;
49
+ private _cache;
50
+ private _graphsLoaded;
51
+ private getBackendManager;
52
+ /** The backend-native manager (WASM or NAPI). Used by forDisplayJson. */
53
+ get wasmManager(): any;
54
+ loadFromGraph(graph: StaticGraph): void;
55
+ retrieve(node: StaticNode): NodeConfigType | null;
56
+ private getConfigFromWasm;
57
+ clear(): void;
58
+ hasGraph(graphId: string): boolean;
59
+ }
60
+ declare const nodeConfigManager: NodeConfigManager;
61
+ export { nodeConfigManager, StaticNodeConfigDomain, StaticNodeConfigBoolean, StaticNodeConfigConcept, StaticNodeConfigReference, NodeConfigManager, };
@@ -0,0 +1,118 @@
1
+ import { StaticTile, StaticNode } from "./static-types";
2
+ import { IViewModel, IPseudo, IRIVM } from "./interfaces";
3
+ import { AttrPromise } from "./utils";
4
+ import { PseudoNode, WasmPseudoValue, WasmPseudoList } from '../pkg/alizarin';
5
+ declare class PseudoUnavailable implements IPseudo {
6
+ parentValue: PseudoValue<any> | null;
7
+ tile: null;
8
+ node: StaticNode;
9
+ isOuter: boolean;
10
+ constructor(node: StaticNode);
11
+ forJson(): Promise<{
12
+ [key: string]: any;
13
+ }[] | null>;
14
+ describeField(): string;
15
+ describeFieldGroup(): string;
16
+ getValue(): AttrPromise<null>;
17
+ getLength(): number;
18
+ getChildren(_?: boolean): any[];
19
+ isIterable(): boolean;
20
+ }
21
+ /**
22
+ * PseudoValue - Thin JS wrapper around WasmPseudoValue from Rust
23
+ *
24
+ * Most state and logic now lives in Rust's RustPseudoValue/WasmPseudoValue.
25
+ * This wrapper provides:
26
+ * 1. JS-specific getViewModel integration
27
+ * 2. Promise-based value loading with AttrPromise
28
+ * 3. Inner/outer pattern coordination
29
+ */
30
+ declare class PseudoValue<VM extends IViewModel> implements IPseudo {
31
+ private _wasm;
32
+ parent: IRIVM<any> | null;
33
+ _parentValue: PseudoValue<any> | null;
34
+ private _inner;
35
+ private _cachedValue;
36
+ private _snapshot;
37
+ private getSnapshot;
38
+ get datatype(): string;
39
+ get isInner(): boolean;
40
+ get isOuter(): boolean;
41
+ get tile(): StaticTile | null;
42
+ set tile(t: StaticTile | null);
43
+ get value(): any;
44
+ get valueLoaded(): boolean | undefined;
45
+ get accessed(): boolean;
46
+ get independent(): boolean;
47
+ get originalTile(): StaticTile | null;
48
+ get node(): WasmPseudoValue;
49
+ get nodeid(): string;
50
+ get inner(): PseudoValue<any> | null;
51
+ get parentValue(): PseudoValue<any> | null;
52
+ set parentValue(newParentValue: PseudoValue<any> | null);
53
+ isIterable(): boolean;
54
+ describeField(): string;
55
+ describeFieldGroup(): string;
56
+ /**
57
+ * Create PseudoValue from WasmPseudoValue (preferred constructor)
58
+ */
59
+ static fromWasm<VM extends IViewModel>(wasm: WasmPseudoValue, parent: IRIVM<any>): PseudoValue<VM>;
60
+ /**
61
+ * Private constructor - use static factories
62
+ */
63
+ private constructor();
64
+ static create<VM extends IViewModel>(nodeOrAlias: StaticNode | string, tile: StaticTile | null, value: any, parent: IRIVM<any>): PseudoValue<VM>;
65
+ getParentTileId(): string | null;
66
+ getTile(): Promise<[StaticTile | null, any[]]>;
67
+ clear(): void;
68
+ updateValue(newTile?: StaticTile | null): AttrPromise<VM>;
69
+ private _updateValueReal;
70
+ /**
71
+ * Sync the ViewModel's tile data to Rust.
72
+ * Called after VM creation/resolution so toTiles()/toResource() can serialize.
73
+ */
74
+ private syncTileData;
75
+ getValue(): AttrPromise<VM | null>;
76
+ getLength(): number;
77
+ getChildTypes(): Promise<object>;
78
+ getChildren(direct?: boolean | null): IPseudo[];
79
+ forJson(): Promise<{
80
+ [key: string]: any;
81
+ } | {
82
+ [key: string]: any;
83
+ }[] | string | number | boolean | null>;
84
+ }
85
+ declare class PseudoList extends Array implements IPseudo {
86
+ node: StaticNode | undefined;
87
+ parent: IRIVM<any> | null | undefined;
88
+ parentValue: PseudoValue<any> | null;
89
+ tile: StaticTile | undefined;
90
+ parenttileId: string | undefined;
91
+ ghostChildren: Set<PseudoValue<any>> | null;
92
+ isOuter: boolean;
93
+ /** Whether this list represents a cardinality-1 node (should unwrap to single value in forJson) */
94
+ isSingle: boolean;
95
+ isIterable(): boolean;
96
+ sorted(): Promise<any[]>;
97
+ describeField(): string;
98
+ describeFieldGroup(): string;
99
+ initialize(node: StaticNode, parent: IRIVM<any> | null): void;
100
+ forJson(): Promise<{
101
+ [key: string]: any;
102
+ }[] | {
103
+ [key: string]: any;
104
+ } | null>;
105
+ getValue(): AttrPromise<PseudoList | IViewModel | null>;
106
+ toString(): string;
107
+ }
108
+ /**
109
+ * Thin wrapper to convert Rust WasmPseudoValue/WasmPseudoList to TS PseudoValue/PseudoList
110
+ * This is the ONLY place where Rust values should be wrapped in TS classes
111
+ *
112
+ * @param rustValue - WasmPseudoValue or WasmPseudoList from Rust
113
+ * @param wkri - The WKRI wrapper (parent IRIVM)
114
+ * @param model - The model wrapper (for getting nodes - currently unused with new pattern)
115
+ * @returns PseudoValue, PseudoList, or PseudoUnavailable
116
+ */
117
+ declare function wrapRustPseudo(rustValue: WasmPseudoValue | WasmPseudoList | null, wkri: IRIVM<any>, model: any): PseudoValue<any> | PseudoList | PseudoUnavailable | null | undefined;
118
+ export { PseudoNode, PseudoValue, PseudoList, PseudoUnavailable, wrapRustPseudo };
package/dist/rdm.d.ts ADDED
@@ -0,0 +1,68 @@
1
+ import { StaticCollection, StaticGraph } from "./static-types";
2
+ import { ArchesClient } from "./client";
3
+ import { isValidUuid } from "../pkg/alizarin";
4
+ export { isValidUuid };
5
+ /**
6
+ * Register an additional datatype for label resolution.
7
+ * Extensions should call this to include their datatypes in resolveLabels.
8
+ * E.g. CLM registers "reference" so reference labels are resolved.
9
+ */
10
+ declare function registerResolvableDatatype(datatype: string): void;
11
+ /**
12
+ * Unregister a previously registered resolvable datatype.
13
+ */
14
+ declare function unregisterResolvableDatatype(datatype: string): void;
15
+ interface ResolveLabelsOptions {
16
+ /** If true, throw errors for unresolved labels. Default: false */
17
+ strict?: boolean;
18
+ /** Additional datatypes to resolve beyond the defaults and any extension-registered types */
19
+ additionalDatatypes?: string[];
20
+ /** Additional config keys to check for collection IDs */
21
+ additionalConfigKeys?: string[];
22
+ }
23
+ declare class ReferenceDataManager {
24
+ archesClient: ArchesClient;
25
+ collections: Map<string, Promise<StaticCollection>>;
26
+ constructor(archesClient: ArchesClient);
27
+ retrieveCollection(id: string): Promise<StaticCollection>;
28
+ /**
29
+ * Add a pre-loaded collection to the cache.
30
+ */
31
+ addCollection(collection: StaticCollection): void;
32
+ /**
33
+ * Check if a collection is cached.
34
+ */
35
+ hasCollection(id: string): boolean;
36
+ /**
37
+ * Clear a specific collection from cache.
38
+ * Also clears from the Rust RDM cache if available.
39
+ */
40
+ clearCollection(id: string): void;
41
+ /**
42
+ * Clear all cached collections.
43
+ * Also clears the Rust RDM cache if available.
44
+ */
45
+ clear(): void;
46
+ /**
47
+ * Resolve label strings to UUIDs in a JSON tree.
48
+ *
49
+ * Uses centralized Rust/WASM implementation for tree traversal and resolution.
50
+ * Only loads collections that are actually needed (lazy loading).
51
+ *
52
+ * @param tree - The data tree to resolve
53
+ * @param graph - The graph definition (for node configs)
54
+ * @param options - Resolution options
55
+ * @returns The tree with labels resolved to UUIDs
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const tree = { status: ["Active", "Pending"] };
60
+ * const resolved = await RDM.resolveLabels(tree, graph);
61
+ * // resolved = { status: ["uuid-1", "uuid-2"] }
62
+ * ```
63
+ */
64
+ resolveLabels<T extends object>(tree: T, graph: StaticGraph, options?: ResolveLabelsOptions): Promise<T>;
65
+ }
66
+ declare const RDM: ReferenceDataManager;
67
+ export { StaticCollection, ReferenceDataManager, RDM, registerResolvableDatatype, unregisterResolvableDatatype };
68
+ export type { ResolveLabelsOptions };
@@ -0,0 +1,65 @@
1
+ import { UrlViewModel, DateViewModel, ResourceInstanceViewModel, DomainValueViewModel, ConceptValueViewModel, NonLocalizedStringViewModel, StringViewModel, SemanticViewModel, BooleanViewModel, NumberViewModel } from './viewModels';
2
+ declare class Cleanable extends String {
3
+ __clean: string | undefined;
4
+ }
5
+ declare abstract class BaseRenderer {
6
+ render(asset: ResourceInstanceViewModel<any>): Promise<any>;
7
+ abstract renderDomainValue(value: DomainValueViewModel, _depth: number): Promise<any>;
8
+ abstract renderDate(value: DateViewModel, _depth: number): Promise<any>;
9
+ abstract renderConceptValue(value: ConceptValueViewModel, _depth: number): Promise<any>;
10
+ abstract renderResourceReference(value: ResourceInstanceViewModel<any>, _depth: number): Promise<any>;
11
+ abstract renderSemantic(value: SemanticViewModel, depth: number): Promise<any>;
12
+ abstract renderBlock(block: {
13
+ [key: string]: string;
14
+ } | {
15
+ [key: string]: string;
16
+ }[], depth: number): any;
17
+ abstract renderArray(value: any[], depth: number): Promise<any>;
18
+ abstract renderString(value: string | StringViewModel | NonLocalizedStringViewModel, _depth: number): Promise<any>;
19
+ abstract renderBoolean(value: boolean | BooleanViewModel, _depth: number): Promise<any>;
20
+ abstract renderNumber(value: number | NumberViewModel, _depth: number): Promise<any>;
21
+ abstract renderUrl(value: UrlViewModel, _depth: number): Promise<any>;
22
+ renderValue(value: any, depth: number): Promise<any>;
23
+ }
24
+ declare class Renderer extends BaseRenderer {
25
+ renderDomainValue(value: DomainValueViewModel, _depth: number): Promise<any>;
26
+ renderString(value: string | StringViewModel | NonLocalizedStringViewModel, _depth: number): Promise<any>;
27
+ renderNumber(value: number | NumberViewModel, _depth: number): Promise<any>;
28
+ renderBoolean(value: boolean | BooleanViewModel, _depth: number): Promise<any>;
29
+ renderDate(value: DateViewModel, _depth: number): Promise<any>;
30
+ renderConceptValue(value: ConceptValueViewModel, _depth: number): Promise<any>;
31
+ renderResourceReference(value: ResourceInstanceViewModel<any>, _depth: number): Promise<any>;
32
+ renderSemantic(value: SemanticViewModel, depth: number): Promise<any>;
33
+ renderUrl(value: UrlViewModel, _depth: number): Promise<any>;
34
+ renderBlock(block: {
35
+ [key: string]: string;
36
+ } | {
37
+ [key: string]: string;
38
+ }[], depth: number): any;
39
+ renderArray(value: any, depth: number): Promise<any>;
40
+ }
41
+ declare class MarkdownRenderer extends Renderer {
42
+ conceptValueToUrl: ((value: ConceptValueViewModel) => string) | undefined;
43
+ dateToText: ((value: DateViewModel) => string) | undefined;
44
+ domainValueToUrl: ((value: DomainValueViewModel) => string) | undefined;
45
+ resourceReferenceToUrl: ((value: ResourceInstanceViewModel<any>) => string) | undefined;
46
+ nodeToUrl: ((value: string) => string) | undefined;
47
+ constructor(callbacks: {
48
+ conceptValueToUrl: ((value: ConceptValueViewModel) => string) | undefined;
49
+ dateToText: ((value: DateViewModel) => string) | undefined;
50
+ domainValueToUrl: ((value: DomainValueViewModel) => string) | undefined;
51
+ resourceReferenceToUrl: ((value: ResourceInstanceViewModel<any>) => string) | undefined;
52
+ nodeToUrl: ((value: string) => string) | undefined;
53
+ });
54
+ renderUrl(value: UrlViewModel, _depth: number): Promise<any>;
55
+ renderDomainValue(domainValue: DomainValueViewModel, _: number): Promise<any>;
56
+ renderDate(date: DateViewModel, _: number): Promise<any>;
57
+ renderConceptValue(conceptValue: ConceptValueViewModel, _: number): Promise<any>;
58
+ renderResourceReference(rivm: ResourceInstanceViewModel<any>, _: number): Promise<any>;
59
+ }
60
+ declare class FlatMarkdownRenderer extends MarkdownRenderer {
61
+ renderSemantic(vm: SemanticViewModel, depth: number): Promise<any>;
62
+ renderArray(value: any, depth: number): Promise<any>;
63
+ renderString(value: string | StringViewModel | NonLocalizedStringViewModel, _depth: number): Promise<any>;
64
+ }
65
+ export { MarkdownRenderer, Cleanable, FlatMarkdownRenderer };
@@ -0,0 +1,35 @@
1
+ import { IStringKeyedObject, IViewModel, IPseudo, IRIVM } from "./interfaces.ts";
2
+ import type { PseudoValue } from "./pseudos";
3
+ import { StaticTile, StaticNode } from "./static-types";
4
+ export declare function resetTimingStats(): void;
5
+ export declare function getTimingStats(): {
6
+ wasmAvgMs: number;
7
+ wrapAvgMs: number;
8
+ wasmCalls: number;
9
+ wasmTotalMs: number;
10
+ wrapCalls: number;
11
+ wrapTotalMs: number;
12
+ };
13
+ export declare function logTimingStats(label?: string): void;
14
+ declare class SemanticViewModel implements IStringKeyedObject, IViewModel {
15
+ [key: string | symbol]: any;
16
+ _: IViewModel | Promise<IViewModel> | undefined;
17
+ then: undefined;
18
+ [Symbol.toPrimitive]: undefined;
19
+ get [Symbol.toStringTag](): string;
20
+ __parentPseudo: PseudoValue<any> | undefined;
21
+ __childValues: Map<string, any>;
22
+ __parentWkri: IRIVM<any> | null;
23
+ __tile: StaticTile | null;
24
+ __node: StaticNode;
25
+ __forJsonCache(): null;
26
+ constructor(parentWkri: IRIVM<any> | null, tile: StaticTile | null, node: StaticNode);
27
+ toString(): Promise<string>;
28
+ toObject(): Promise<Record<string, any>>;
29
+ __get(key: string): Promise<IViewModel | IViewModel[]>;
30
+ __has(key: string): any;
31
+ __getChildValue(key: string): Promise<IPseudo> | null | undefined;
32
+ static __create(tile: StaticTile, node: StaticNode, _value: any, parent: IRIVM<any> | null): Promise<SemanticViewModel>;
33
+ __asTileData(): Promise<[null, any[]]>;
34
+ }
35
+ export { SemanticViewModel };
@@ -0,0 +1,172 @@
1
+ import { StaticGraphMeta, StaticNode, StaticTranslatableString, StaticNodegroup, StaticConstraint, StaticCard, StaticCardsXNodesXWidgets, StaticFunctionsXGraphs, StaticPublication, StaticTile, StaticGraph, StaticEdge, StaticResourceDescriptors, StaticResourceMetadata, StaticResourceSummary, StaticResourceReference, StaticResource, StaticResourceRegistry } from '../pkg/alizarin';
2
+ interface IStaticDescriptorConfig {
3
+ descriptor_types: {
4
+ nodegroup_id: string;
5
+ string_template: string;
6
+ }[];
7
+ }
8
+ declare function createStaticGraph(props: {
9
+ author?: string;
10
+ color?: string | null;
11
+ config?: object;
12
+ deploymentdate?: null | string;
13
+ deploymentfile?: null | string;
14
+ description?: string | StaticTranslatableString;
15
+ graphid?: string;
16
+ iconclass?: string;
17
+ is_editable?: boolean | null;
18
+ isresource?: boolean;
19
+ jsonldcontext?: string | {
20
+ [key: string]: any;
21
+ } | null;
22
+ name: string | StaticTranslatableString;
23
+ ontology_id?: string | string[] | null;
24
+ relatable_resource_model_ids?: Array<string>;
25
+ resource_2_resource_constraints?: Array<any> | null;
26
+ slug?: string | null;
27
+ subtitle?: string | StaticTranslatableString;
28
+ template_id?: string;
29
+ version?: string;
30
+ }, published?: boolean): StaticGraph;
31
+ declare class StaticValue {
32
+ id: string;
33
+ value: string;
34
+ __concept?: StaticConcept | null;
35
+ __conceptId?: string | null;
36
+ constructor(jsonData: StaticValue, concept?: StaticConcept | string | null);
37
+ toJSON(): {
38
+ id: string;
39
+ value: string;
40
+ };
41
+ toString(): string;
42
+ static create(referent: string | StaticConcept, valueType: string, value: string, language?: string): StaticValue;
43
+ }
44
+ declare class StaticConcept {
45
+ id: string;
46
+ prefLabels: {
47
+ [lang: string]: StaticValue;
48
+ };
49
+ source: string | null;
50
+ sortOrder: number | null;
51
+ children: StaticConcept[] | null;
52
+ constructor(jsonData: StaticConcept);
53
+ getPrefLabel?(): StaticValue;
54
+ toString(): any;
55
+ static fromValue(conceptScheme: StaticConcept | null, value: string | StaticValue | {
56
+ [lang: string]: StaticValue;
57
+ }, children?: (string | StaticValue | StaticConcept)[], config?: {
58
+ baseLanguage?: string;
59
+ source?: string | null;
60
+ sortOrder?: number | null;
61
+ }): StaticConcept;
62
+ }
63
+ /**
64
+ * Type of SKOS grouping structure.
65
+ * - ConceptScheme: Uses narrower/broader hierarchy (default)
66
+ * - Collection: Uses flat member relationships (Arches-compatible)
67
+ */
68
+ export type SkosNodeType = 'ConceptScheme' | 'Collection';
69
+ declare class StaticCollection {
70
+ id: string;
71
+ uri?: string;
72
+ prefLabels: {
73
+ [lang: string]: StaticValue;
74
+ };
75
+ altLabels?: {
76
+ [lang: string]: StaticValue[];
77
+ };
78
+ scopeNotes?: {
79
+ [lang: string]: StaticValue;
80
+ };
81
+ nodeType: SkosNodeType;
82
+ concepts: {
83
+ [conceptId: string]: StaticConcept;
84
+ };
85
+ __allConcepts: {
86
+ [conceptId: string]: StaticConcept;
87
+ };
88
+ __values: {
89
+ [valueId: string]: StaticValue;
90
+ };
91
+ static fromConceptScheme(props: {
92
+ collectionid?: string;
93
+ name?: string | {
94
+ [lang: string]: StaticValue;
95
+ } | StaticValue;
96
+ conceptScheme: StaticConcept;
97
+ nodeType?: SkosNodeType;
98
+ }): StaticCollection;
99
+ /**
100
+ * Create a new StaticCollection.
101
+ * @param props.nodeType - 'ConceptScheme' (default) for hierarchical, 'Collection' for flat Arches-compatible
102
+ */
103
+ static create(props: {
104
+ collectionid?: string;
105
+ uri?: string;
106
+ name: string | {
107
+ [lang: string]: StaticValue;
108
+ } | StaticValue;
109
+ concepts: StaticConcept[] | {
110
+ [conceptId: string]: StaticConcept;
111
+ };
112
+ nodeType?: SkosNodeType;
113
+ }): StaticCollection;
114
+ constructor(jsonData: StaticCollection);
115
+ getConceptValue?(valueId: string): StaticValue;
116
+ getConceptByValue?(label: string): StaticConcept;
117
+ private _syncedToRustCache;
118
+ /**
119
+ * Ensure this collection is synced to the Rust RDM cache.
120
+ * This is called automatically by hierarchy methods, but can be called
121
+ * explicitly to pre-sync collections before label resolution.
122
+ * @throws Error if WASM is not initialized
123
+ */
124
+ ensureInCache?(): void;
125
+ /**
126
+ * Get the parent concept ID for a given concept.
127
+ * Uses the Rust RDM cache for hierarchy lookups.
128
+ * @returns The parent concept ID, or null if no parent (top-level concept)
129
+ * @throws Error if WASM is not initialized
130
+ */
131
+ getParentId?(conceptId: string): string | null;
132
+ /**
133
+ * Get the parent concept for a given concept.
134
+ * @returns The parent concept, or null if no parent
135
+ */
136
+ getParent?(conceptId: string): StaticConcept | null;
137
+ /**
138
+ * Get all ancestor concepts for a given concept (parent, grandparent, etc).
139
+ * Returns in order from immediate parent to root.
140
+ */
141
+ getAncestors?(conceptId: string): StaticConcept[];
142
+ /**
143
+ * Ensure this collection's data is in the Rust RDM cache.
144
+ * Called lazily when hierarchy lookups are needed.
145
+ * @internal
146
+ */
147
+ private _ensureInRustCache;
148
+ /**
149
+ * Convert collection concepts to the format expected by Rust cache.
150
+ * @internal
151
+ */
152
+ private _toRustCacheFormat;
153
+ toString(): string;
154
+ }
155
+ declare class StaticDomainValue {
156
+ id: string;
157
+ selected: boolean;
158
+ text: {
159
+ [lang: string]: string;
160
+ };
161
+ constructor(jsonData: StaticDomainValue);
162
+ toString(): string;
163
+ lang(lang: string): string | undefined;
164
+ forJson(): Promise<{
165
+ id: string;
166
+ selected: boolean;
167
+ text: {
168
+ [lang: string]: string;
169
+ };
170
+ }>;
171
+ }
172
+ export { StaticValue, StaticTile, StaticGraph, createStaticGraph, StaticResource, StaticResourceSummary, StaticResourceMetadata, StaticResourceRegistry, StaticNode, StaticNodegroup, StaticEdge, StaticCard, StaticCardsXNodesXWidgets, StaticCollection, StaticConcept, StaticDomainValue, StaticResourceReference, StaticGraphMeta, StaticFunctionsXGraphs, StaticResourceDescriptors, StaticTranslatableString, StaticConstraint, StaticPublication, type IStaticDescriptorConfig, type SkosNodeType };
@@ -0,0 +1,60 @@
1
+ import { ArchesClient } from "./client.ts";
2
+ import { StaticResource, StaticResourceSummary, StaticResourceMetadata, StaticResourceRegistry, StaticTile } from "./static-types";
3
+ /**
4
+ * StaticStore - Thin wrapper around StaticResourceRegistry with optional archesClient fallback
5
+ *
6
+ * Primary mode: Resources are pre-loaded into the registry before use.
7
+ * Fallback mode: If archesClient is set and resource not in registry, loads on-demand.
8
+ *
9
+ * Methods return sync results wrapped in Promises for API compatibility.
10
+ */
11
+ declare class StaticStore {
12
+ private _registry;
13
+ private _archesClient;
14
+ constructor(registry?: StaticResourceRegistry);
15
+ get archesClient(): ArchesClient | null;
16
+ set archesClient(client: ArchesClient | null);
17
+ /**
18
+ * Get or create the registry (lazy initialization for WASM timing)
19
+ */
20
+ get registry(): StaticResourceRegistry;
21
+ /**
22
+ * Set the registry (allows replacing with a pre-populated registry)
23
+ */
24
+ set registry(registry: StaticResourceRegistry);
25
+ /**
26
+ * Get metadata for a resource from the registry (or load via archesClient if available).
27
+ */
28
+ getMeta(id: string, onlyIfCached?: boolean): Promise<StaticResourceMetadata | null>;
29
+ /**
30
+ * Get all full resources for a graph.
31
+ * First yields from registry, then loads remaining via archesClient if available.
32
+ */
33
+ loadAll(graphId: string, limit?: number | undefined, useCache?: boolean): AsyncIterable<StaticResource>;
34
+ /**
35
+ * Get a full resource from the registry (or load via archesClient if available).
36
+ */
37
+ loadOne(id: string): Promise<StaticResource>;
38
+ /**
39
+ * Get all summaries for a graph.
40
+ */
41
+ loadAllSummaries(graphId: string, limit?: number | undefined): AsyncIterable<StaticResourceSummary>;
42
+ /**
43
+ * Get tiles for a resource.
44
+ */
45
+ loadTiles(id: string, nodegroupId?: string | null): Promise<StaticTile[]>;
46
+ /**
47
+ * Get a full resource with tiles loaded.
48
+ */
49
+ ensureFullResource(id: string): Promise<StaticResource>;
50
+ /**
51
+ * Check if a resource exists in the registry.
52
+ */
53
+ contains(id: string): boolean;
54
+ /**
55
+ * Check if a full resource (with tiles) exists in the registry.
56
+ */
57
+ hasFull(id: string): boolean;
58
+ }
59
+ declare const staticStore: StaticStore;
60
+ export { staticStore, StaticStore };