alizarin 2.0.0-beta.1 → 2.0.0-beta.4

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/README.md CHANGED
@@ -38,36 +38,40 @@ npm install alizarin
38
38
  ### Basic Usage
39
39
 
40
40
  ```typescript
41
- import { ArchesClientRemote, GraphManager } from 'alizarin';
41
+ import { client, graphManager, staticStore, RDM } from 'alizarin';
42
42
 
43
- // Connect to an Arches instance
44
- const client = new ArchesClientRemote('https://your-arches-instance.org');
45
- const graphManager = new GraphManager(client);
43
+ // Point the shared graphManager (and the stores it uses) at an Arches instance
44
+ const archesClient = new client.ArchesClientRemote('https://your-arches-instance.org');
45
+ graphManager.archesClient = archesClient;
46
+ staticStore.archesClient = archesClient;
47
+ RDM.archesClient = archesClient;
48
+ await graphManager.initialize();
46
49
 
47
- // Load a resource model
50
+ // Load a resource model and query all monuments
48
51
  const MonumentModel = await graphManager.loadGraph('Monument');
49
-
50
- // Query all monuments
51
52
  const monuments = await MonumentModel.all();
52
53
 
53
- // Access monument data
54
+ // Property access is asynchronous — values are lazily hydrated, so `await` each.
54
55
  for (const monument of monuments) {
55
- console.log(monument.name);
56
- console.log(monument.constructionDate);
57
- console.log(monument.heritage_status?.prefLabel);
56
+ console.log(await monument.name);
57
+ console.log(await monument.constructionDate);
58
+ console.log(await monument.heritage_status); // concept: a String subclass, stringifies to its label
58
59
  }
59
60
  ```
60
61
 
61
62
  ### Working with Static Data
62
63
 
63
64
  ```typescript
64
- import { ArchesClientRemoteStatic, GraphManager } from 'alizarin';
65
+ import { client, graphManager, staticStore, RDM } from 'alizarin';
65
66
 
66
- // Load from static JSON exports
67
- const client = new ArchesClientRemoteStatic('/data/exports');
68
- const graphManager = new GraphManager(client);
67
+ // Load from static JSON exports (no live server needed)
68
+ const archesClient = new client.ArchesClientRemoteStatic('/data/exports');
69
+ graphManager.archesClient = archesClient;
70
+ staticStore.archesClient = archesClient;
71
+ RDM.archesClient = archesClient;
72
+ await graphManager.initialize();
69
73
 
70
- // Usage is identical to remote client
74
+ // Usage is identical to the remote client
71
75
  const PersonModel = await graphManager.loadGraph('Person');
72
76
  ```
73
77