@twin.org/standards-schema-org 0.0.1-next.30 → 0.0.1-next.31
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/dist/cjs/index.cjs +23 -13
- package/dist/esm/index.mjs +23 -14
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/schemaOrgContexts.d.ts +13 -0
- package/dist/types/models/schemaOrgTypes.d.ts +0 -4
- package/docs/changelog.md +1 -1
- package/docs/reference/index.md +2 -0
- package/docs/reference/type-aliases/SchemaOrgContexts.md +5 -0
- package/docs/reference/variables/SchemaOrgContexts.md +13 -0
- package/docs/reference/variables/SchemaOrgTypes.md +0 -6
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -7,14 +7,23 @@ var dataJsonLd = require('@twin.org/data-json-ld');
|
|
|
7
7
|
// Copyright 2024 IOTA Stiftung.
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0.
|
|
9
9
|
/**
|
|
10
|
-
* The
|
|
10
|
+
* The contexts of schema.org data.
|
|
11
11
|
*/
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
-
const
|
|
13
|
+
const SchemaOrgContexts = {
|
|
14
14
|
/**
|
|
15
15
|
* Context Root.
|
|
16
16
|
*/
|
|
17
|
-
ContextRoot: "https://schema.org"
|
|
17
|
+
ContextRoot: "https://schema.org"
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Copyright 2024 IOTA Stiftung.
|
|
21
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
22
|
+
/**
|
|
23
|
+
* The types of schema.org data.
|
|
24
|
+
*/
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
26
|
+
const SchemaOrgTypes = {
|
|
18
27
|
/**
|
|
19
28
|
* Represents text storage.
|
|
20
29
|
*/
|
|
@@ -172,7 +181,7 @@ class SchemaOrgDataTypes {
|
|
|
172
181
|
* Register all the data types.
|
|
173
182
|
*/
|
|
174
183
|
static registerTypes() {
|
|
175
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
184
|
+
dataCore.DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Text}`, () => ({
|
|
176
185
|
type: SchemaOrgTypes.Text,
|
|
177
186
|
defaultValue: "",
|
|
178
187
|
jsonSchema: async () => ({
|
|
@@ -180,7 +189,7 @@ class SchemaOrgDataTypes {
|
|
|
180
189
|
}),
|
|
181
190
|
validate: async (propertyName, value, failures, container) => core.Validation.string(propertyName, value, failures)
|
|
182
191
|
}));
|
|
183
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
192
|
+
dataCore.DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Integer}`, () => ({
|
|
184
193
|
type: SchemaOrgTypes.Integer,
|
|
185
194
|
defaultValue: 0,
|
|
186
195
|
jsonSchema: async () => ({
|
|
@@ -188,7 +197,7 @@ class SchemaOrgDataTypes {
|
|
|
188
197
|
}),
|
|
189
198
|
validate: async (propertyName, value, failures, container) => core.Validation.integer(propertyName, value, failures)
|
|
190
199
|
}));
|
|
191
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
200
|
+
dataCore.DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Float}`, () => ({
|
|
192
201
|
type: SchemaOrgTypes.Float,
|
|
193
202
|
defaultValue: 0,
|
|
194
203
|
jsonSchema: async () => ({
|
|
@@ -196,7 +205,7 @@ class SchemaOrgDataTypes {
|
|
|
196
205
|
}),
|
|
197
206
|
validate: async (propertyName, value, failures, container) => core.Validation.number(propertyName, value, failures)
|
|
198
207
|
}));
|
|
199
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
208
|
+
dataCore.DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Boolean}`, () => ({
|
|
200
209
|
type: SchemaOrgTypes.Boolean,
|
|
201
210
|
defaultValue: true,
|
|
202
211
|
jsonSchema: async () => ({
|
|
@@ -204,7 +213,7 @@ class SchemaOrgDataTypes {
|
|
|
204
213
|
}),
|
|
205
214
|
validate: async (propertyName, value, failures, container) => core.Validation.boolean(propertyName, value, failures)
|
|
206
215
|
}));
|
|
207
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
216
|
+
dataCore.DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.URL}`, () => ({
|
|
208
217
|
type: SchemaOrgTypes.URL,
|
|
209
218
|
defaultValue: "",
|
|
210
219
|
jsonSchema: async () => ({
|
|
@@ -213,7 +222,7 @@ class SchemaOrgDataTypes {
|
|
|
213
222
|
}),
|
|
214
223
|
validate: async (propertyName, value, failures, container) => core.Url.validate(propertyName, value, failures)
|
|
215
224
|
}));
|
|
216
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
225
|
+
dataCore.DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Date}`, () => ({
|
|
217
226
|
type: SchemaOrgTypes.Date,
|
|
218
227
|
defaultValue: new Date(),
|
|
219
228
|
jsonSchema: async () => ({
|
|
@@ -222,7 +231,7 @@ class SchemaOrgDataTypes {
|
|
|
222
231
|
}),
|
|
223
232
|
validate: async (propertyName, value, failures, container) => core.Validation.dateString(propertyName, value, failures)
|
|
224
233
|
}));
|
|
225
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
234
|
+
dataCore.DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.DateTime}`, () => ({
|
|
226
235
|
type: SchemaOrgTypes.DateTime,
|
|
227
236
|
defaultValue: new Date(),
|
|
228
237
|
jsonSchema: async () => ({
|
|
@@ -231,7 +240,7 @@ class SchemaOrgDataTypes {
|
|
|
231
240
|
}),
|
|
232
241
|
validate: async (propertyName, value, failures, container) => core.Validation.dateTimeString(propertyName, value, failures)
|
|
233
242
|
}));
|
|
234
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
243
|
+
dataCore.DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Time}`, () => ({
|
|
235
244
|
type: SchemaOrgTypes.Time,
|
|
236
245
|
defaultValue: new Date(),
|
|
237
246
|
jsonSchema: async () => ({
|
|
@@ -240,7 +249,7 @@ class SchemaOrgDataTypes {
|
|
|
240
249
|
}),
|
|
241
250
|
validate: async (propertyName, value, failures, container) => core.Validation.timeString(propertyName, value, failures)
|
|
242
251
|
}));
|
|
243
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
252
|
+
dataCore.DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Image}`, () => ({
|
|
244
253
|
type: SchemaOrgTypes.Image,
|
|
245
254
|
defaultValue: "",
|
|
246
255
|
jsonSchema: async () => ({
|
|
@@ -249,7 +258,7 @@ class SchemaOrgDataTypes {
|
|
|
249
258
|
}),
|
|
250
259
|
validate: async (propertyName, value, failures, container) => core.Url.validate(propertyName, value, failures)
|
|
251
260
|
}));
|
|
252
|
-
dataCore.DataTypeHandlerFactory.register(`${
|
|
261
|
+
dataCore.DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.GeoCoordinates}`, () => ({
|
|
253
262
|
type: SchemaOrgTypes.GeoCoordinates,
|
|
254
263
|
defaultValue: { longitude: 0, latitude: 0 },
|
|
255
264
|
jsonSchema: async () => GeoCoordinatesSchema,
|
|
@@ -258,6 +267,7 @@ class SchemaOrgDataTypes {
|
|
|
258
267
|
}
|
|
259
268
|
}
|
|
260
269
|
|
|
270
|
+
exports.SchemaOrgContexts = SchemaOrgContexts;
|
|
261
271
|
exports.SchemaOrgDataTypes = SchemaOrgDataTypes;
|
|
262
272
|
exports.SchemaOrgTypes = SchemaOrgTypes;
|
|
263
273
|
exports.SchemaOrgValidation = SchemaOrgValidation;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -5,14 +5,23 @@ import { JsonLdProcessor } from '@twin.org/data-json-ld';
|
|
|
5
5
|
// Copyright 2024 IOTA Stiftung.
|
|
6
6
|
// SPDX-License-Identifier: Apache-2.0.
|
|
7
7
|
/**
|
|
8
|
-
* The
|
|
8
|
+
* The contexts of schema.org data.
|
|
9
9
|
*/
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
-
const
|
|
11
|
+
const SchemaOrgContexts = {
|
|
12
12
|
/**
|
|
13
13
|
* Context Root.
|
|
14
14
|
*/
|
|
15
|
-
ContextRoot: "https://schema.org"
|
|
15
|
+
ContextRoot: "https://schema.org"
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Copyright 2024 IOTA Stiftung.
|
|
19
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
20
|
+
/**
|
|
21
|
+
* The types of schema.org data.
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
24
|
+
const SchemaOrgTypes = {
|
|
16
25
|
/**
|
|
17
26
|
* Represents text storage.
|
|
18
27
|
*/
|
|
@@ -170,7 +179,7 @@ class SchemaOrgDataTypes {
|
|
|
170
179
|
* Register all the data types.
|
|
171
180
|
*/
|
|
172
181
|
static registerTypes() {
|
|
173
|
-
DataTypeHandlerFactory.register(`${
|
|
182
|
+
DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Text}`, () => ({
|
|
174
183
|
type: SchemaOrgTypes.Text,
|
|
175
184
|
defaultValue: "",
|
|
176
185
|
jsonSchema: async () => ({
|
|
@@ -178,7 +187,7 @@ class SchemaOrgDataTypes {
|
|
|
178
187
|
}),
|
|
179
188
|
validate: async (propertyName, value, failures, container) => Validation.string(propertyName, value, failures)
|
|
180
189
|
}));
|
|
181
|
-
DataTypeHandlerFactory.register(`${
|
|
190
|
+
DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Integer}`, () => ({
|
|
182
191
|
type: SchemaOrgTypes.Integer,
|
|
183
192
|
defaultValue: 0,
|
|
184
193
|
jsonSchema: async () => ({
|
|
@@ -186,7 +195,7 @@ class SchemaOrgDataTypes {
|
|
|
186
195
|
}),
|
|
187
196
|
validate: async (propertyName, value, failures, container) => Validation.integer(propertyName, value, failures)
|
|
188
197
|
}));
|
|
189
|
-
DataTypeHandlerFactory.register(`${
|
|
198
|
+
DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Float}`, () => ({
|
|
190
199
|
type: SchemaOrgTypes.Float,
|
|
191
200
|
defaultValue: 0,
|
|
192
201
|
jsonSchema: async () => ({
|
|
@@ -194,7 +203,7 @@ class SchemaOrgDataTypes {
|
|
|
194
203
|
}),
|
|
195
204
|
validate: async (propertyName, value, failures, container) => Validation.number(propertyName, value, failures)
|
|
196
205
|
}));
|
|
197
|
-
DataTypeHandlerFactory.register(`${
|
|
206
|
+
DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Boolean}`, () => ({
|
|
198
207
|
type: SchemaOrgTypes.Boolean,
|
|
199
208
|
defaultValue: true,
|
|
200
209
|
jsonSchema: async () => ({
|
|
@@ -202,7 +211,7 @@ class SchemaOrgDataTypes {
|
|
|
202
211
|
}),
|
|
203
212
|
validate: async (propertyName, value, failures, container) => Validation.boolean(propertyName, value, failures)
|
|
204
213
|
}));
|
|
205
|
-
DataTypeHandlerFactory.register(`${
|
|
214
|
+
DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.URL}`, () => ({
|
|
206
215
|
type: SchemaOrgTypes.URL,
|
|
207
216
|
defaultValue: "",
|
|
208
217
|
jsonSchema: async () => ({
|
|
@@ -211,7 +220,7 @@ class SchemaOrgDataTypes {
|
|
|
211
220
|
}),
|
|
212
221
|
validate: async (propertyName, value, failures, container) => Url.validate(propertyName, value, failures)
|
|
213
222
|
}));
|
|
214
|
-
DataTypeHandlerFactory.register(`${
|
|
223
|
+
DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Date}`, () => ({
|
|
215
224
|
type: SchemaOrgTypes.Date,
|
|
216
225
|
defaultValue: new Date(),
|
|
217
226
|
jsonSchema: async () => ({
|
|
@@ -220,7 +229,7 @@ class SchemaOrgDataTypes {
|
|
|
220
229
|
}),
|
|
221
230
|
validate: async (propertyName, value, failures, container) => Validation.dateString(propertyName, value, failures)
|
|
222
231
|
}));
|
|
223
|
-
DataTypeHandlerFactory.register(`${
|
|
232
|
+
DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.DateTime}`, () => ({
|
|
224
233
|
type: SchemaOrgTypes.DateTime,
|
|
225
234
|
defaultValue: new Date(),
|
|
226
235
|
jsonSchema: async () => ({
|
|
@@ -229,7 +238,7 @@ class SchemaOrgDataTypes {
|
|
|
229
238
|
}),
|
|
230
239
|
validate: async (propertyName, value, failures, container) => Validation.dateTimeString(propertyName, value, failures)
|
|
231
240
|
}));
|
|
232
|
-
DataTypeHandlerFactory.register(`${
|
|
241
|
+
DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Time}`, () => ({
|
|
233
242
|
type: SchemaOrgTypes.Time,
|
|
234
243
|
defaultValue: new Date(),
|
|
235
244
|
jsonSchema: async () => ({
|
|
@@ -238,7 +247,7 @@ class SchemaOrgDataTypes {
|
|
|
238
247
|
}),
|
|
239
248
|
validate: async (propertyName, value, failures, container) => Validation.timeString(propertyName, value, failures)
|
|
240
249
|
}));
|
|
241
|
-
DataTypeHandlerFactory.register(`${
|
|
250
|
+
DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.Image}`, () => ({
|
|
242
251
|
type: SchemaOrgTypes.Image,
|
|
243
252
|
defaultValue: "",
|
|
244
253
|
jsonSchema: async () => ({
|
|
@@ -247,7 +256,7 @@ class SchemaOrgDataTypes {
|
|
|
247
256
|
}),
|
|
248
257
|
validate: async (propertyName, value, failures, container) => Url.validate(propertyName, value, failures)
|
|
249
258
|
}));
|
|
250
|
-
DataTypeHandlerFactory.register(`${
|
|
259
|
+
DataTypeHandlerFactory.register(`${SchemaOrgContexts.ContextRoot}${SchemaOrgTypes.GeoCoordinates}`, () => ({
|
|
251
260
|
type: SchemaOrgTypes.GeoCoordinates,
|
|
252
261
|
defaultValue: { longitude: 0, latitude: 0 },
|
|
253
262
|
jsonSchema: async () => GeoCoordinatesSchema,
|
|
@@ -256,4 +265,4 @@ class SchemaOrgDataTypes {
|
|
|
256
265
|
}
|
|
257
266
|
}
|
|
258
267
|
|
|
259
|
-
export { SchemaOrgDataTypes, SchemaOrgTypes, SchemaOrgValidation };
|
|
268
|
+
export { SchemaOrgContexts, SchemaOrgDataTypes, SchemaOrgTypes, SchemaOrgValidation };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contexts of schema.org data.
|
|
3
|
+
*/
|
|
4
|
+
export declare const SchemaOrgContexts: {
|
|
5
|
+
/**
|
|
6
|
+
* Context Root.
|
|
7
|
+
*/
|
|
8
|
+
readonly ContextRoot: "https://schema.org";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The contexts of schema.org data.
|
|
12
|
+
*/
|
|
13
|
+
export type SchemaOrgContexts = (typeof SchemaOrgContexts)[keyof typeof SchemaOrgContexts];
|
package/docs/changelog.md
CHANGED
package/docs/reference/index.md
CHANGED
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
## Type Aliases
|
|
9
9
|
|
|
10
|
+
- [SchemaOrgContexts](type-aliases/SchemaOrgContexts.md)
|
|
10
11
|
- [SchemaOrgTypes](type-aliases/SchemaOrgTypes.md)
|
|
11
12
|
|
|
12
13
|
## Variables
|
|
13
14
|
|
|
15
|
+
- [SchemaOrgContexts](variables/SchemaOrgContexts.md)
|
|
14
16
|
- [SchemaOrgTypes](variables/SchemaOrgTypes.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Variable: SchemaOrgContexts
|
|
2
|
+
|
|
3
|
+
> `const` **SchemaOrgContexts**: `object`
|
|
4
|
+
|
|
5
|
+
The contexts of schema.org data.
|
|
6
|
+
|
|
7
|
+
## Type declaration
|
|
8
|
+
|
|
9
|
+
### ContextRoot
|
|
10
|
+
|
|
11
|
+
> `readonly` **ContextRoot**: `"https://schema.org"` = `"https://schema.org"`
|
|
12
|
+
|
|
13
|
+
Context Root.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/standards-schema-org",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.31",
|
|
4
4
|
"description": "Models which define the structure of schema.org Standard",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@twin.org/entity": "next",
|
|
21
21
|
"@twin.org/nameof": "next",
|
|
22
22
|
"@types/json-schema": "7.0.15",
|
|
23
|
-
"schema-dts": "1.1.
|
|
23
|
+
"schema-dts": "1.1.5"
|
|
24
24
|
},
|
|
25
25
|
"main": "./dist/cjs/index.cjs",
|
|
26
26
|
"module": "./dist/esm/index.mjs",
|