@digitalculture/ochre-sdk 0.1.19

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Forum for Digital Culture - University of Chicago
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # OCHRE SDK
2
+
3
+ A JavaScript/TypeScript SDK for working with OCHRE (Online Cultural and Historical Research Environment) data.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @uchicago/ochre
9
+ or
10
+ npm install @uchicago/ochre
11
+ or
12
+ bun install @uchicago/ochre
13
+ ```
14
+
15
+ ## Features
16
+
17
+ - Type-safe parsing of OCHRE data structures
18
+ - Comprehensive TypeScript types for OCHRE entities
19
+ - Utilities for handling OCHRE websites, resources, and metadata
20
+ - Support for parsing rich text, documents, and multilingual content
21
+
22
+ ## Usage
23
+
24
+ ```typescript
25
+ import { fetchWebsite, fetchResource, fetchSet } from "@uchicago/ochre";
26
+
27
+ // Fetch and parse OCHRE website data
28
+ const website = await fetchWebsite(abbreviation);
29
+
30
+ // Fetch and parse OCHRE resource data
31
+ const resource = await fetchResource(uuid);
32
+
33
+ // Fetch and parse OCHRE set data
34
+ const set = await fetchSet(uuid);
35
+ ```
36
+
37
+ ## API Reference
38
+
39
+ ### Core Functions
40
+
41
+ #### `fetchWebsite(abbreviation: string): Promise<Website | null>`
42
+
43
+ Fetch and parse OCHRE website data.
44
+
45
+ ```typescript
46
+ const website = await fetchWebsite("guerrilla-television");
47
+ ```
48
+
49
+ #### `fetchResource(uuid: string): Promise<Resource | null>`
50
+
51
+ Fetch and parse OCHRE resource data.
52
+
53
+ ```typescript
54
+ const resource = await fetchResource("27adf18a-21ad-442b-b186-0c7f3b8cb2d1");
55
+ ```
56
+
57
+ ### Types
58
+
59
+ The SDK provides comprehensive TypeScript types for OCHRE data structures. Key types include:
60
+
61
+ - `Website` - Represents an OCHRE website
62
+ - `Resource` - Represents an OCHRE resource
63
+ - `Set` - Represents an OCHRE set
64
+ - `Document` - Represents an OCHRE MDX document
65
+ - `WebElement` - Represents a web element in an OCHRE website
66
+ - And many more...
67
+
68
+ ## Contributing
69
+
70
+ Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
71
+
72
+ ## License
73
+
74
+ [MIT](LICENSE)