@sorane/okf 0.2.0 → 0.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sorane/okf",
3
- "version": "0.2.0",
3
+ "version": "0.2.6",
4
4
  "description": "Open Knowledge Format parsing, validation, and serialization for sorane",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -12,7 +12,8 @@
12
12
  "homepage": "https://sorane.dev",
13
13
  "bugs": "https://github.com/masanork/sorane/issues",
14
14
  "files": [
15
- "src"
15
+ "src",
16
+ "profile"
16
17
  ],
17
18
  "exports": {
18
19
  ".": "./src/index.ts"
@@ -0,0 +1,51 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://sorane.dev/profile/sorane-okf/0.1",
4
+ "title": "sorane-okf/0.1",
5
+ "description": "OKF v0.1 profile for sorane SSG. Required OKF field: type. Profile adds title for article.",
6
+ "oneOf": [
7
+ { "$ref": "#/$defs/article" },
8
+ { "$ref": "#/$defs/index" }
9
+ ],
10
+ "$defs": {
11
+ "okfBase": {
12
+ "type": "object",
13
+ "required": ["type"],
14
+ "properties": {
15
+ "type": { "type": "string", "minLength": 1 },
16
+ "title": { "type": "string", "minLength": 1 },
17
+ "description": { "type": "string" },
18
+ "resource": { "type": "string" },
19
+ "tags": {
20
+ "type": "array",
21
+ "items": { "type": "string" }
22
+ },
23
+ "timestamp": { "type": "string", "format": "date-time" },
24
+ "profile": { "type": "string" }
25
+ },
26
+ "additionalProperties": true
27
+ },
28
+ "article": {
29
+ "allOf": [
30
+ { "$ref": "#/$defs/okfBase" },
31
+ {
32
+ "properties": {
33
+ "type": { "const": "article" }
34
+ },
35
+ "required": ["type", "title"]
36
+ }
37
+ ]
38
+ },
39
+ "index": {
40
+ "allOf": [
41
+ { "$ref": "#/$defs/okfBase" },
42
+ {
43
+ "properties": {
44
+ "type": { "const": "index" }
45
+ },
46
+ "required": ["type", "title"]
47
+ }
48
+ ]
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://sorane.dev/profile/sorane-okf/0.2",
4
+ "title": "sorane-okf/0.2",
5
+ "description": "OKF v0.1 profile for sorane SSG with optional AI content disclosure fields.",
6
+ "oneOf": [
7
+ { "$ref": "#/$defs/article" },
8
+ { "$ref": "#/$defs/index" }
9
+ ],
10
+ "$defs": {
11
+ "okfBase": {
12
+ "type": "object",
13
+ "required": ["type"],
14
+ "properties": {
15
+ "type": { "type": "string", "minLength": 1 },
16
+ "title": { "type": "string", "minLength": 1 },
17
+ "description": { "type": "string" },
18
+ "resource": { "type": "string" },
19
+ "tags": {
20
+ "type": "array",
21
+ "items": { "type": "string" }
22
+ },
23
+ "timestamp": { "type": "string", "format": "date-time" },
24
+ "profile": { "type": "string" },
25
+ "digitalSourceType": {
26
+ "type": "string",
27
+ "minLength": 1,
28
+ "description": "IPTC Digital Source Type short code or full cv.iptc.org URI (schema.org digitalSourceType)"
29
+ },
30
+ "euAiLabel": {
31
+ "type": "string",
32
+ "enum": ["basic", "fully-generated", "partially-modified"]
33
+ },
34
+ "aiDisclosureNote": { "type": "string", "maxLength": 500 },
35
+ "aiSystems": {
36
+ "type": "array",
37
+ "maxItems": 10,
38
+ "items": {
39
+ "type": "object",
40
+ "required": ["name"],
41
+ "properties": {
42
+ "name": { "type": "string", "minLength": 1 },
43
+ "version": { "type": "string" },
44
+ "provider": { "type": "string" }
45
+ },
46
+ "additionalProperties": false
47
+ }
48
+ }
49
+ },
50
+ "additionalProperties": true
51
+ },
52
+ "article": {
53
+ "allOf": [
54
+ { "$ref": "#/$defs/okfBase" },
55
+ {
56
+ "properties": {
57
+ "type": { "const": "article" }
58
+ },
59
+ "required": ["type", "title"]
60
+ }
61
+ ]
62
+ },
63
+ "index": {
64
+ "allOf": [
65
+ { "$ref": "#/$defs/okfBase" },
66
+ {
67
+ "properties": {
68
+ "type": { "const": "index" }
69
+ },
70
+ "required": ["type", "title"]
71
+ }
72
+ ]
73
+ }
74
+ }
75
+ }
package/src/validate.ts CHANGED
@@ -9,8 +9,7 @@ import { normalizeConcept } from "./normalize.ts";
9
9
  import { parseYaml } from "./yaml.ts";
10
10
 
11
11
  const __dirname = dirname(fileURLToPath(import.meta.url));
12
- const REPO_ROOT = join(__dirname, "../../..");
13
- const PROFILE_SCHEMA_DIR = join(REPO_ROOT, "profile");
12
+ const PROFILE_SCHEMA_DIR = join(__dirname, "../profile");
14
13
 
15
14
  const SUPPORTED_PROFILE_RE = /^sorane-okf\/(0\.[12])$/;
16
15
  const DEFAULT_PROFILE = "sorane-okf/0.1";