@mark1russell7/canon-ontology 0.0.0-stage → 0.2.0
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 +21 -0
- package/README.md +39 -2
- package/build/index.d.mts +655 -0
- package/build/index.mjs +2131 -0
- package/build/index.mjs.map +1 -0
- package/build/targets-DkEkvgll.d.mts +194 -0
- package/build/targets-DsUgzuOM.mjs +877 -0
- package/build/targets-DsUgzuOM.mjs.map +1 -0
- package/build/targets.d.mts +2 -0
- package/build/targets.mjs +1 -0
- package/package.json +74 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mark Russell
|
|
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
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mark1russell7/canon-ontology
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@mark1russell7/canon-ontology)
|
|
4
|
+
|
|
5
|
+
This package is the ontology of [canon](https://github.com/metrograph-labs/canon). It has the grammar, the read and the check of the records. It also has the import of the map of homes and the target query.
|
|
6
|
+
|
|
7
|
+
The records are JSON files in the folder `ontology` of the repository. The grammar is in the folder `schema`. Each function of this package reads a clone of the repository: give the root folder of the clone.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @mark1russell7/canon-ontology
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The package needs Node.js 22 or later.
|
|
16
|
+
|
|
17
|
+
## Read and check the records
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { checkOntology, readOntology, targetsOf } from "@mark1russell7/canon-ontology";
|
|
21
|
+
|
|
22
|
+
const ontology = readOntology("/path/to/canon");
|
|
23
|
+
const problems = checkOntology(ontology);
|
|
24
|
+
const targets = targetsOf(ontology);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Function | Function of the function |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `readOntology(root)` | It reads the grammar and each record of the clone. A file that it cannot read gives an `OntologyReadError`. |
|
|
30
|
+
| `checkOntology(ontology)` | It gives each problem of the records: a wrong schema, an unknown kind, an edge to no record. No problem gives an empty list. |
|
|
31
|
+
| `targetsOf(ontology)` | It gives each target of the target query: each gap of the ontology as a unit of work, the claimable targets first. |
|
|
32
|
+
| `findRoot(folder)` | It gives the root of the clone that contains the folder, or `undefined`. |
|
|
33
|
+
|
|
34
|
+
## The command line
|
|
35
|
+
|
|
36
|
+
In a clone of canon, `pnpm canon check` checks the records, `pnpm canon targets` shows the targets, and `pnpm canon results` shows the state of each claim.
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
MIT
|