@twin.org/standards-schema-org 0.0.3-next.8 → 0.9.0-next.1
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 +2 -2
- package/dist/es/dataTypes/schemaOrgDataTypes.js +21 -21
- package/dist/es/dataTypes/schemaOrgDataTypes.js.map +1 -1
- package/dist/es/models/schemaOrgContexts.js +10 -4
- package/dist/es/models/schemaOrgContexts.js.map +1 -1
- package/dist/types/models/schemaOrgContexts.d.ts +10 -4
- package/docs/changelog.md +541 -69
- package/docs/examples.md +26 -1
- package/docs/reference/classes/SchemaOrgDataTypes.md +2 -2
- package/docs/reference/classes/SchemaOrgValidation.md +1 -1
- package/docs/reference/variables/SchemaOrgContexts.md +14 -6
- package/docs/reference/variables/SchemaOrgTypes.md +14 -14
- package/package.json +10 -10
package/docs/examples.md
CHANGED
|
@@ -1 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Standards Schema.org Examples
|
|
2
|
+
|
|
3
|
+
These snippets register data types and validate coordinate payloads against schema.org constraints.
|
|
4
|
+
|
|
5
|
+
## SchemaOrgValidation
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import type { IValidationFailure } from '@twin.org/core';
|
|
9
|
+
import { SchemaOrgDataTypes, SchemaOrgValidation } from '@twin.org/standards-schema-org';
|
|
10
|
+
|
|
11
|
+
SchemaOrgDataTypes.registerRedirects();
|
|
12
|
+
SchemaOrgDataTypes.registerTypes();
|
|
13
|
+
|
|
14
|
+
const failures: IValidationFailure[] = [];
|
|
15
|
+
const valid = SchemaOrgValidation.geoCoordinates(
|
|
16
|
+
'site.geo',
|
|
17
|
+
{
|
|
18
|
+
latitude: 53.3498,
|
|
19
|
+
longitude: -6.2603
|
|
20
|
+
},
|
|
21
|
+
failures
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
console.log(valid); // true
|
|
25
|
+
console.log(failures.length); // 0
|
|
26
|
+
```
|
|
@@ -14,7 +14,7 @@ Handle all the data types for schema.org.
|
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
17
|
-
### registerRedirects()
|
|
17
|
+
### registerRedirects() {#registerredirects}
|
|
18
18
|
|
|
19
19
|
> `static` **registerRedirects**(): `void`
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ Register the JSON-LD Redirects.
|
|
|
26
26
|
|
|
27
27
|
***
|
|
28
28
|
|
|
29
|
-
### registerTypes()
|
|
29
|
+
### registerTypes() {#registertypes}
|
|
30
30
|
|
|
31
31
|
> `static` **registerTypes**(): `void`
|
|
32
32
|
|
|
@@ -6,14 +6,22 @@ The contexts of schema.org data.
|
|
|
6
6
|
|
|
7
7
|
## Type Declaration
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### Namespace {#namespace}
|
|
10
10
|
|
|
11
|
-
> `readonly` **
|
|
11
|
+
> `readonly` **Namespace**: `"https://schema.org/"` = `"https://schema.org/"`
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The canonical RDF namespace URI.
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### Context {#context}
|
|
16
16
|
|
|
17
|
-
> `readonly` **
|
|
17
|
+
> `readonly` **Context**: `"https://schema.org"` = `"https://schema.org"`
|
|
18
18
|
|
|
19
|
-
The
|
|
19
|
+
The value to use in @context.
|
|
20
|
+
Note: Context differs from Namespace (no trailing slash) as per schema.org specification.
|
|
21
|
+
The schema.org JSON-LD context URL format does not include a trailing slash.
|
|
22
|
+
|
|
23
|
+
### JsonLdContext {#jsonldcontext}
|
|
24
|
+
|
|
25
|
+
> `readonly` **JsonLdContext**: `"https://schema.org/docs/jsonldcontext.json"` = `"https://schema.org/docs/jsonldcontext.json"`
|
|
26
|
+
|
|
27
|
+
The JSON-LD Context URL.
|
|
@@ -6,85 +6,85 @@ The types of schema.org data.
|
|
|
6
6
|
|
|
7
7
|
## Type Declaration
|
|
8
8
|
|
|
9
|
-
### Text
|
|
9
|
+
### Text {#text}
|
|
10
10
|
|
|
11
11
|
> `readonly` **Text**: `"Text"` = `"Text"`
|
|
12
12
|
|
|
13
13
|
Represents text storage.
|
|
14
14
|
|
|
15
|
-
### Integer
|
|
15
|
+
### Integer {#integer}
|
|
16
16
|
|
|
17
17
|
> `readonly` **Integer**: `"Integer"` = `"Integer"`
|
|
18
18
|
|
|
19
19
|
Represents integer number values.
|
|
20
20
|
|
|
21
|
-
### Float
|
|
21
|
+
### Float {#float}
|
|
22
22
|
|
|
23
23
|
> `readonly` **Float**: `"Float"` = `"Float"`
|
|
24
24
|
|
|
25
25
|
Represents floating point numbers.
|
|
26
26
|
|
|
27
|
-
### Boolean
|
|
27
|
+
### Boolean {#boolean}
|
|
28
28
|
|
|
29
29
|
> `readonly` **Boolean**: `"Boolean"` = `"Boolean"`
|
|
30
30
|
|
|
31
31
|
Represents a boolean.
|
|
32
32
|
|
|
33
|
-
### URL
|
|
33
|
+
### URL {#url}
|
|
34
34
|
|
|
35
35
|
> `readonly` **URL**: `"URL"` = `"URL"`
|
|
36
36
|
|
|
37
37
|
Represents a url.
|
|
38
38
|
|
|
39
|
-
### Date
|
|
39
|
+
### Date {#date}
|
|
40
40
|
|
|
41
41
|
> `readonly` **Date**: `"Date"` = `"Date"`
|
|
42
42
|
|
|
43
43
|
Represents a date as an ISO format string.
|
|
44
44
|
|
|
45
|
-
### DateTime
|
|
45
|
+
### DateTime {#datetime}
|
|
46
46
|
|
|
47
47
|
> `readonly` **DateTime**: `"DateTime"` = `"DateTime"`
|
|
48
48
|
|
|
49
49
|
Represents a date time as an ISO format string.
|
|
50
50
|
|
|
51
|
-
### Time
|
|
51
|
+
### Time {#time}
|
|
52
52
|
|
|
53
53
|
> `readonly` **Time**: `"Time"` = `"Time"`
|
|
54
54
|
|
|
55
55
|
Represents a time as an ISO format string.
|
|
56
56
|
|
|
57
|
-
### Image
|
|
57
|
+
### Image {#image}
|
|
58
58
|
|
|
59
59
|
> `readonly` **Image**: `"image"` = `"image"`
|
|
60
60
|
|
|
61
61
|
Represents a url which points to an image.
|
|
62
62
|
|
|
63
|
-
### GeoCoordinates
|
|
63
|
+
### GeoCoordinates {#geocoordinates}
|
|
64
64
|
|
|
65
65
|
> `readonly` **GeoCoordinates**: `"GeoCoordinates"` = `"GeoCoordinates"`
|
|
66
66
|
|
|
67
67
|
Represents a location.
|
|
68
68
|
|
|
69
|
-
### StructuredValue
|
|
69
|
+
### StructuredValue {#structuredvalue}
|
|
70
70
|
|
|
71
71
|
> `readonly` **StructuredValue**: `"StructuredValue"` = `"StructuredValue"`
|
|
72
72
|
|
|
73
73
|
Represents a structured value.
|
|
74
74
|
|
|
75
|
-
### ItemList
|
|
75
|
+
### ItemList {#itemlist}
|
|
76
76
|
|
|
77
77
|
> `readonly` **ItemList**: `"ItemList"` = `"ItemList"`
|
|
78
78
|
|
|
79
79
|
Represents an item list.
|
|
80
80
|
|
|
81
|
-
### ItemListElement
|
|
81
|
+
### ItemListElement {#itemlistelement}
|
|
82
82
|
|
|
83
83
|
> `readonly` **ItemListElement**: `"itemListElement"` = `"itemListElement"`
|
|
84
84
|
|
|
85
85
|
Represents an item list element.
|
|
86
86
|
|
|
87
|
-
### NextItem
|
|
87
|
+
### NextItem {#nextitem}
|
|
88
88
|
|
|
89
89
|
> `readonly` **NextItem**: `"nextItem"` = `"nextItem"`
|
|
90
90
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/standards-schema-org",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.9.0-next.1",
|
|
4
|
+
"description": "Data models for Schema.org vocabularies.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/twin-standards.git",
|
|
8
8
|
"directory": "packages/standards-schema-org"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "next",
|
|
18
|
-
"@twin.org/data-core": "next",
|
|
19
|
-
"@twin.org/data-json-ld": "next",
|
|
20
|
-
"@twin.org/entity": "next",
|
|
21
|
-
"@twin.org/nameof": "next",
|
|
22
|
-
"schema-dts": "
|
|
17
|
+
"@twin.org/core": "0.9.0-next.1",
|
|
18
|
+
"@twin.org/data-core": "0.9.0-next.1",
|
|
19
|
+
"@twin.org/data-json-ld": "0.9.0-next.1",
|
|
20
|
+
"@twin.org/entity": "0.9.0-next.1",
|
|
21
|
+
"@twin.org/nameof": "0.9.0-next.1",
|
|
22
|
+
"schema-dts": "2.0.0"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/es/index.js",
|
|
25
25
|
"types": "./dist/types/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"seo"
|
|
52
52
|
],
|
|
53
53
|
"bugs": {
|
|
54
|
-
"url": "git+https://github.com/
|
|
54
|
+
"url": "git+https://github.com/iotaledger/twin-standards/issues"
|
|
55
55
|
},
|
|
56
56
|
"homepage": "https://twindev.org"
|
|
57
57
|
}
|