@lincs.project/webannotation-schema 1.11.0 → 1.12.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/dist/index.d.mts +3965 -470
- package/dist/index.d.ts +3965 -470
- package/dist/index.js +214 -84
- package/dist/index.mjs +211 -83
- package/dist/v1/jsonld/context.jsonld +2 -1
- package/dist/v1/jsonld/defs.jsonld +185 -17
- package/dist/v1/jsonld/schema.jsonld +36 -5
- package/dist/v1/standalone/linc-wa-validator.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ __export(src_exports, {
|
|
|
46
46
|
Description: () => Description,
|
|
47
47
|
Event: () => Event,
|
|
48
48
|
EventEntityType: () => EventEntityType,
|
|
49
|
+
Group: () => Group,
|
|
49
50
|
Keyword: () => Keyword,
|
|
50
51
|
KeywordEntityType: () => KeywordEntityType,
|
|
51
52
|
KeywordFolksnomy: () => KeywordFolksnomy,
|
|
@@ -98,7 +99,6 @@ __export(src_exports, {
|
|
|
98
99
|
contextUri: () => contextUri,
|
|
99
100
|
correctionEntityTypeSchema: () => correctionEntityTypeSchema,
|
|
100
101
|
correctionSchema: () => correctionSchema,
|
|
101
|
-
creatorSchema: () => creatorSchema,
|
|
102
102
|
dateEntityTypeSchema: () => dateEntityTypeSchema,
|
|
103
103
|
dateSchema: () => dateSchema,
|
|
104
104
|
definitionSchema: () => definitionSchema,
|
|
@@ -107,6 +107,7 @@ __export(src_exports, {
|
|
|
107
107
|
eventEntityTypeSchema: () => eventEntityTypeSchema,
|
|
108
108
|
eventSchema: () => eventSchema,
|
|
109
109
|
formatSchema: () => formatSchema,
|
|
110
|
+
groupSchema: () => groupSchema,
|
|
110
111
|
isIdentifiedBy: () => isIdentifiedBy,
|
|
111
112
|
isIndentifyBySchema: () => isIndentifyBySchema,
|
|
112
113
|
keywordEntityTypeSchema: () => keywordEntityTypeSchema,
|
|
@@ -142,6 +143,7 @@ __export(src_exports, {
|
|
|
142
143
|
textPositionSelectorSchema: () => textPositionSelectorSchema,
|
|
143
144
|
textQuoteSelectorExtendedSchema: () => textQuoteSelectorExtendedSchema,
|
|
144
145
|
textQuoteSelectorSchema: () => textQuoteSelectorSchema,
|
|
146
|
+
userSchema: () => userSchema,
|
|
145
147
|
v1: () => v1_exports,
|
|
146
148
|
validate: () => validate,
|
|
147
149
|
validator: () => validator,
|
|
@@ -162,14 +164,15 @@ var defsId = `https://wa.lincsproject.ca/${VERSION}/defs.jsonld`;
|
|
|
162
164
|
// src/v1/schema/context.ts
|
|
163
165
|
var schemaContext = {
|
|
164
166
|
"@context": {
|
|
167
|
+
biography: "http://id.lincsproject.ca/biography/",
|
|
165
168
|
bf: "http://www.openlinksw.com/schemas/bif#",
|
|
166
169
|
cito: "http://purl.org/spar/cito/",
|
|
170
|
+
crmdig: "http://www.ics.forth.gr/isl/CRMdig/",
|
|
167
171
|
cwrc: "http://id.lincsproject.ca/cwrc/",
|
|
168
172
|
edit: "http://id.lincsproject.ca/edit/",
|
|
169
173
|
fabio: "https://purl.org/spar/fabio/",
|
|
170
174
|
frbroo: "http://iflastandards.info/ns/fr/frbr/frbroo/",
|
|
171
175
|
wikidata: "http://www.wikidata.org/entity/",
|
|
172
|
-
crmdig: "http://www.ics.forth.gr/isl/CRMdig/",
|
|
173
176
|
citing: "edit:citing",
|
|
174
177
|
correcting: "edit:correcting",
|
|
175
178
|
"oa:identifying": {
|
|
@@ -214,43 +217,64 @@ var schemaContext = {
|
|
|
214
217
|
}
|
|
215
218
|
};
|
|
216
219
|
|
|
217
|
-
// src/v1/schema/definitions/
|
|
220
|
+
// src/v1/schema/definitions/agents.ts
|
|
218
221
|
var import_zod = require("zod");
|
|
219
|
-
var userIdDescription = "The IRI that identifies the agent (Creator or Contributor).";
|
|
220
222
|
var User = import_zod.z.object({
|
|
221
|
-
id: import_zod.z.string().url()
|
|
222
|
-
type: import_zod.z.literal("crm:E21_Person")
|
|
223
|
-
name: import_zod.z.string().min(1, { message: "Cannot be empty" }).describe(
|
|
223
|
+
id: import_zod.z.string().url(),
|
|
224
|
+
type: import_zod.z.literal("crm:E21_Person"),
|
|
225
|
+
name: import_zod.z.string().min(1, { message: "Cannot be empty" }).describe(`The person's name.`)
|
|
224
226
|
}).describe("Human Agent");
|
|
225
|
-
var
|
|
227
|
+
var userSchema = {
|
|
226
228
|
type: "object",
|
|
227
|
-
description: "
|
|
229
|
+
description: "User Agent",
|
|
228
230
|
properties: {
|
|
229
|
-
id: { type: "string", format: "uri"
|
|
231
|
+
id: { type: "string", format: "uri" },
|
|
230
232
|
type: { type: "string", const: "crm:E21_Person" },
|
|
231
|
-
name: { type: "string", minLength: 1, description:
|
|
233
|
+
name: { type: "string", minLength: 1, description: `The person's name.` }
|
|
234
|
+
},
|
|
235
|
+
required: ["id", "type", "name"]
|
|
236
|
+
};
|
|
237
|
+
var Group = import_zod.z.object({
|
|
238
|
+
id: import_zod.z.string().url(),
|
|
239
|
+
type: import_zod.z.literal("crm:E74_Group"),
|
|
240
|
+
name: import_zod.z.string().min(1).describe(`The group's name.`)
|
|
241
|
+
}).describe("Group Agent");
|
|
242
|
+
var groupSchema = {
|
|
243
|
+
type: "object",
|
|
244
|
+
description: "Group Agent",
|
|
245
|
+
properties: {
|
|
246
|
+
id: { type: "string", format: "uri" },
|
|
247
|
+
type: { type: "string", const: "crm:E74_Group" },
|
|
248
|
+
name: { type: "string", minLength: 1, description: `The group's name.` }
|
|
232
249
|
},
|
|
233
250
|
required: ["id", "type", "name"]
|
|
234
251
|
};
|
|
235
|
-
var softwareIdDescription = "The IRI that identifies the agent (software).";
|
|
236
252
|
var Software = import_zod.z.object({
|
|
237
|
-
id: import_zod.z.string().url()
|
|
238
|
-
type: import_zod.z.literal("Software").
|
|
253
|
+
id: import_zod.z.string().url(),
|
|
254
|
+
type: import_zod.z.tuple([import_zod.z.literal("Software"), import_zod.z.literal("crm:E73_Information_Object")]),
|
|
239
255
|
P16_used_specific_object: import_zod.z.string().url().optional().describe("The URI that identifies the agent (software)"),
|
|
240
|
-
|
|
256
|
+
name: import_zod.z.string().min(1).describe(`The software's name.`),
|
|
241
257
|
softwareVersion: import_zod.z.string().optional().describe("The software version.")
|
|
242
258
|
}).describe("Software Agent");
|
|
243
259
|
var softwareSchema = {
|
|
244
260
|
type: "object",
|
|
245
261
|
description: "Software Agent",
|
|
246
262
|
properties: {
|
|
247
|
-
id: { type: "string", format: "uri"
|
|
248
|
-
type: {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
263
|
+
id: { type: "string", format: "uri" },
|
|
264
|
+
type: {
|
|
265
|
+
type: "array",
|
|
266
|
+
minItems: 2,
|
|
267
|
+
maxItems: 2,
|
|
268
|
+
items: [
|
|
269
|
+
{ type: "string", const: "Software" },
|
|
270
|
+
{ type: "string", const: "crm:E73_Information_Object" }
|
|
271
|
+
]
|
|
272
|
+
},
|
|
273
|
+
P16_used_specific_object: { type: "string", format: "uri", nullable: true },
|
|
274
|
+
name: { type: "string", minLength: 1, description: `The software's name.` },
|
|
275
|
+
softwareVersion: { type: "string", nullable: true, description: "The software version." }
|
|
252
276
|
},
|
|
253
|
-
required: ["id", "type", "
|
|
277
|
+
required: ["id", "type", "name"]
|
|
254
278
|
};
|
|
255
279
|
|
|
256
280
|
// src/v1/schema/definitions/body/index.ts
|
|
@@ -849,8 +873,8 @@ var physicalThingSchema = {
|
|
|
849
873
|
// src/v1/schema/definitions/body/place.ts
|
|
850
874
|
var import_zod14 = require("zod");
|
|
851
875
|
var PlaceEntityType = import_zod14.z.union([
|
|
852
|
-
import_zod14.z.literal("
|
|
853
|
-
import_zod14.z.tuple([import_zod14.z.literal("
|
|
876
|
+
import_zod14.z.literal("crm:E53_Place"),
|
|
877
|
+
import_zod14.z.tuple([import_zod14.z.literal("biography:fictionalPlace"), import_zod14.z.literal("crm:E89_Propositional_Object")])
|
|
854
878
|
]);
|
|
855
879
|
var Place = import_zod14.z.object({
|
|
856
880
|
id: import_zod14.z.string().url().describe(bodyIdDescription),
|
|
@@ -861,13 +885,13 @@ var Place = import_zod14.z.object({
|
|
|
861
885
|
}).describe("Place");
|
|
862
886
|
var placeEntityTypeSchema = {
|
|
863
887
|
oneOf: [
|
|
864
|
-
{ type: "string", const: "
|
|
888
|
+
{ type: "string", const: "crm:E53_Place" },
|
|
865
889
|
{
|
|
866
890
|
type: "array",
|
|
867
891
|
minItems: 2,
|
|
868
892
|
maxItems: 2,
|
|
869
893
|
items: [
|
|
870
|
-
{ type: "string", const: "
|
|
894
|
+
{ type: "string", const: "biography:fictionalPlace" },
|
|
871
895
|
{ type: "string", const: "crm:E89_Propositional_Object" }
|
|
872
896
|
]
|
|
873
897
|
}
|
|
@@ -895,13 +919,13 @@ var placeSchema = {
|
|
|
895
919
|
then: {
|
|
896
920
|
type: "object",
|
|
897
921
|
properties: {
|
|
898
|
-
entityType: "
|
|
922
|
+
entityType: "crm:E53_Place"
|
|
899
923
|
}
|
|
900
924
|
},
|
|
901
925
|
else: {
|
|
902
926
|
type: "object",
|
|
903
927
|
properties: {
|
|
904
|
-
entityType: ["
|
|
928
|
+
entityType: ["biography:fictionalPlace", "crm:E89_Propositional_Object"]
|
|
905
929
|
}
|
|
906
930
|
}
|
|
907
931
|
}
|
|
@@ -1150,10 +1174,10 @@ var bodySchema = {
|
|
|
1150
1174
|
};
|
|
1151
1175
|
|
|
1152
1176
|
// src/v1/schema/definitions/target/index.ts
|
|
1153
|
-
var
|
|
1177
|
+
var import_zod25 = require("zod");
|
|
1154
1178
|
|
|
1155
1179
|
// src/v1/schema/definitions/target/selector/index.ts
|
|
1156
|
-
var
|
|
1180
|
+
var import_zod23 = require("zod");
|
|
1157
1181
|
|
|
1158
1182
|
// src/v1/schema/definitions/target/selector/range.ts
|
|
1159
1183
|
var import_zod21 = require("zod");
|
|
@@ -1361,13 +1385,64 @@ var rangeSelectorSchema = {
|
|
|
1361
1385
|
required: ["id", "type", "startSelector", "endSelector"]
|
|
1362
1386
|
};
|
|
1363
1387
|
|
|
1388
|
+
// src/v1/schema/definitions/target/selector/css.ts
|
|
1389
|
+
var import_zod22 = require("zod");
|
|
1390
|
+
var CssSelector = import_zod22.z.object({
|
|
1391
|
+
id: import_zod22.z.string().describe(selectorIdDescription),
|
|
1392
|
+
type: import_zod22.z.tuple([import_zod22.z.literal("CssSelector"), import_zod22.z.literal("crm:E73_Information_Object")]),
|
|
1393
|
+
value: import_zod22.z.string().min(1).describe("The CSS to the selected a segment.")
|
|
1394
|
+
}).describe("CSS Selector");
|
|
1395
|
+
var CssSelectorExtended = CssSelector.extend({
|
|
1396
|
+
refinedBy: import_zod22.z.union([TextPositionSelector, TextQuoteSelector]).optional().describe(selectorRefinedByDescription)
|
|
1397
|
+
});
|
|
1398
|
+
var cssSelectorSchema = {
|
|
1399
|
+
type: "object",
|
|
1400
|
+
description: "Css Selector",
|
|
1401
|
+
properties: {
|
|
1402
|
+
id: { type: "string", format: "uri", description: selectorIdDescription },
|
|
1403
|
+
type: {
|
|
1404
|
+
type: "array",
|
|
1405
|
+
minItems: 2,
|
|
1406
|
+
maxItems: 2,
|
|
1407
|
+
items: [
|
|
1408
|
+
{ type: "string", const: "CssSelector" },
|
|
1409
|
+
{ type: "string", const: "crm:E73_Information_Object" }
|
|
1410
|
+
],
|
|
1411
|
+
description: "The class of the Selector,"
|
|
1412
|
+
},
|
|
1413
|
+
value: {
|
|
1414
|
+
type: "string",
|
|
1415
|
+
description: "Web Annotation Target Select CSS"
|
|
1416
|
+
}
|
|
1417
|
+
},
|
|
1418
|
+
required: ["id", "type", "value"]
|
|
1419
|
+
};
|
|
1420
|
+
var cssSelectorExtendedSchema = {
|
|
1421
|
+
type: "object",
|
|
1422
|
+
description: "CSS Selector",
|
|
1423
|
+
properties: {
|
|
1424
|
+
...cssSelectorSchema.properties,
|
|
1425
|
+
refinedBy: {
|
|
1426
|
+
type: "object",
|
|
1427
|
+
description: selectorRefinedByDescription,
|
|
1428
|
+
anyOf: [
|
|
1429
|
+
{ $ref: "defs.jsonld#/definitions/textPositionSelector" },
|
|
1430
|
+
{ $ref: "defs.jsonld#/definitions/textQuoteSelector" }
|
|
1431
|
+
],
|
|
1432
|
+
required: []
|
|
1433
|
+
}
|
|
1434
|
+
},
|
|
1435
|
+
required: ["id", "type", "value"]
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1364
1438
|
// src/v1/schema/definitions/target/selector/index.ts
|
|
1365
1439
|
var selectorIdDescription = "UUID that identifies the selector.";
|
|
1366
1440
|
var selectorRefinedByDescription = "The relationship between a broader selector and the more specific selector that should be applied to the results of the first.";
|
|
1367
|
-
var Selector =
|
|
1441
|
+
var Selector = import_zod23.z.union([
|
|
1368
1442
|
TextQuoteSelectorExtended,
|
|
1369
1443
|
TextPositionSelectorExtended,
|
|
1370
1444
|
XpathSelectorExtended,
|
|
1445
|
+
CssSelectorExtended,
|
|
1371
1446
|
RangeSelector
|
|
1372
1447
|
]);
|
|
1373
1448
|
var selectorSchema = {
|
|
@@ -1376,22 +1451,23 @@ var selectorSchema = {
|
|
|
1376
1451
|
textQuoteSelectorExtendedSchema,
|
|
1377
1452
|
textPositionSelectorExtendedSchema,
|
|
1378
1453
|
xpathSelectorExtendedSchema,
|
|
1454
|
+
cssSelectorExtendedSchema,
|
|
1379
1455
|
rangeSelectorSchema
|
|
1380
1456
|
],
|
|
1381
1457
|
required: []
|
|
1382
1458
|
};
|
|
1383
1459
|
|
|
1384
1460
|
// src/v1/schema/definitions/target/source.ts
|
|
1385
|
-
var
|
|
1461
|
+
var import_zod24 = require("zod");
|
|
1386
1462
|
var formatDescription = "The format of the Web Resource's content. The value of the property should be the media-type of the format, following the [rfc6838] specification.";
|
|
1387
|
-
var Format =
|
|
1463
|
+
var Format = import_zod24.z.string().min(1).describe(formatDescription);
|
|
1388
1464
|
var formatSchema = {
|
|
1389
1465
|
type: "string",
|
|
1390
1466
|
description: formatDescription,
|
|
1391
1467
|
minLength: 1
|
|
1392
1468
|
};
|
|
1393
1469
|
var languageDescription = "The language of the Web Resource's content. The value of the property should be a language code following the [bcp47] specification.";
|
|
1394
|
-
var Language =
|
|
1470
|
+
var Language = import_zod24.z.string().min(2).max(3).describe(languageDescription);
|
|
1395
1471
|
var languageSchema = {
|
|
1396
1472
|
type: "string",
|
|
1397
1473
|
description: languageDescription,
|
|
@@ -1399,19 +1475,19 @@ var languageSchema = {
|
|
|
1399
1475
|
maxLength: 3
|
|
1400
1476
|
};
|
|
1401
1477
|
var sourceIdDescription = "The IRI that identifies the Target source.";
|
|
1402
|
-
var isIdentifiedBy =
|
|
1403
|
-
id:
|
|
1404
|
-
type:
|
|
1405
|
-
title:
|
|
1478
|
+
var isIdentifiedBy = import_zod24.z.object({
|
|
1479
|
+
id: import_zod24.z.string().url(),
|
|
1480
|
+
type: import_zod24.z.literal("crm:E33_E41_Linguistic_Appellation"),
|
|
1481
|
+
title: import_zod24.z.string().min(1, { message: "The title cannot be empty" }).describe("The title of the document being annotated.")
|
|
1406
1482
|
});
|
|
1407
|
-
var Source =
|
|
1408
|
-
id:
|
|
1409
|
-
type:
|
|
1410
|
-
format:
|
|
1483
|
+
var Source = import_zod24.z.object({
|
|
1484
|
+
id: import_zod24.z.string().url().describe(sourceIdDescription),
|
|
1485
|
+
type: import_zod24.z.literal("crm:D1_Digital_Object"),
|
|
1486
|
+
format: import_zod24.z.union([Format, import_zod24.z.array(Format).min(1)]).optional().describe(
|
|
1411
1487
|
"The formats of the Web Resource's content. The value of the property should and array of media-types of the format, following the [rfc6838] specification."
|
|
1412
1488
|
),
|
|
1413
1489
|
P1_is_identified_by: isIdentifiedBy.optional(),
|
|
1414
|
-
language:
|
|
1490
|
+
language: import_zod24.z.union([Language, import_zod24.z.array(Language).min(1)]).optional().describe(
|
|
1415
1491
|
"The languages of the Web Resource's content. The value of the property should be an array of language code following the [bcp47] specification."
|
|
1416
1492
|
)
|
|
1417
1493
|
}).describe("Web Annotation Target");
|
|
@@ -1474,14 +1550,14 @@ var sourceSchema = {
|
|
|
1474
1550
|
|
|
1475
1551
|
// src/v1/schema/definitions/target/index.ts
|
|
1476
1552
|
var targetIdDescription = "The IRI that identifies the Target resource.";
|
|
1477
|
-
var Target =
|
|
1478
|
-
id:
|
|
1479
|
-
type:
|
|
1553
|
+
var Target = import_zod25.z.object({
|
|
1554
|
+
id: import_zod25.z.string().url().describe(targetIdDescription),
|
|
1555
|
+
type: import_zod25.z.tuple([import_zod25.z.literal("SpecificResource"), import_zod25.z.literal("crm:E73_Information_Object")]).describe("The class of the Specific Resource."),
|
|
1480
1556
|
source: Source,
|
|
1481
1557
|
renderedVia: Software.optional().describe(
|
|
1482
1558
|
"The relationship between the Specific Resource that represents the Target in the annotation, and the piece of software or other system that was used to render the Target when the annotation was created."
|
|
1483
1559
|
),
|
|
1484
|
-
selector:
|
|
1560
|
+
selector: import_zod25.z.union([Selector, import_zod25.z.array(Selector)]).describe("The relationship between a Specific Resource and a Selector.").optional()
|
|
1485
1561
|
}).describe("Web Annotation Target");
|
|
1486
1562
|
var targetSchema = {
|
|
1487
1563
|
type: "object",
|
|
@@ -1597,6 +1673,33 @@ var targetSchema = {
|
|
|
1597
1673
|
}
|
|
1598
1674
|
}
|
|
1599
1675
|
},
|
|
1676
|
+
{
|
|
1677
|
+
if: {
|
|
1678
|
+
type: "object",
|
|
1679
|
+
properties: {
|
|
1680
|
+
selector: {
|
|
1681
|
+
type: "object",
|
|
1682
|
+
properties: {
|
|
1683
|
+
type: {
|
|
1684
|
+
type: "array",
|
|
1685
|
+
minItems: 2,
|
|
1686
|
+
maxItems: 2,
|
|
1687
|
+
items: [
|
|
1688
|
+
{ type: "string", const: "CssSelector" },
|
|
1689
|
+
{ type: "string", const: "crm:E73_Information_Object" }
|
|
1690
|
+
]
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
},
|
|
1696
|
+
then: {
|
|
1697
|
+
type: "object",
|
|
1698
|
+
properties: {
|
|
1699
|
+
selector: { type: "object", required: ["type", "value"] }
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
},
|
|
1600
1703
|
{
|
|
1601
1704
|
if: {
|
|
1602
1705
|
type: "object",
|
|
@@ -1628,7 +1731,7 @@ var targetSchema = {
|
|
|
1628
1731
|
};
|
|
1629
1732
|
|
|
1630
1733
|
// src/v1/schema/definitions/common.ts
|
|
1631
|
-
var
|
|
1734
|
+
var import_zod26 = require("zod");
|
|
1632
1735
|
var Quality = [
|
|
1633
1736
|
"edit:qualityLow",
|
|
1634
1737
|
"edit:qualityMedium",
|
|
@@ -1636,14 +1739,14 @@ var Quality = [
|
|
|
1636
1739
|
"edit:qualityUnknown"
|
|
1637
1740
|
];
|
|
1638
1741
|
var certaintyDescription = "Indicates the degree of certainty associated with some aspect of an assertion, description, identification, or entity linked to the annotation body.";
|
|
1639
|
-
var Certainty =
|
|
1742
|
+
var Certainty = import_zod26.z.enum(Quality).describe(certaintyDescription);
|
|
1640
1743
|
var certaintySchema = {
|
|
1641
1744
|
type: "string",
|
|
1642
1745
|
enum: Quality,
|
|
1643
1746
|
description: certaintyDescription
|
|
1644
1747
|
};
|
|
1645
1748
|
var precisionDescription = "Indicates the degree of precision associated with the location of the entity linked to the annotation body.";
|
|
1646
|
-
var Precision =
|
|
1749
|
+
var Precision = import_zod26.z.enum(Quality).describe(precisionDescription);
|
|
1647
1750
|
var precisionSchema = {
|
|
1648
1751
|
type: "string",
|
|
1649
1752
|
enum: Quality,
|
|
@@ -1655,7 +1758,8 @@ var definitionSchema = {
|
|
|
1655
1758
|
$id: defsId,
|
|
1656
1759
|
type: "object",
|
|
1657
1760
|
definitions: {
|
|
1658
|
-
|
|
1761
|
+
user: userSchema,
|
|
1762
|
+
group: groupSchema,
|
|
1659
1763
|
software: softwareSchema,
|
|
1660
1764
|
target: targetSchema,
|
|
1661
1765
|
textPositionSelector: textPositionSelectorSchema,
|
|
@@ -1669,7 +1773,7 @@ var definitionSchema = {
|
|
|
1669
1773
|
};
|
|
1670
1774
|
|
|
1671
1775
|
// src/v1/schema/root.ts
|
|
1672
|
-
var
|
|
1776
|
+
var import_zod27 = require("zod");
|
|
1673
1777
|
var Motivation = [
|
|
1674
1778
|
"oa:identifying",
|
|
1675
1779
|
"oa:describing",
|
|
@@ -1679,30 +1783,30 @@ var Motivation = [
|
|
|
1679
1783
|
"oa:linking",
|
|
1680
1784
|
"citing"
|
|
1681
1785
|
];
|
|
1682
|
-
var WebAnnotation =
|
|
1683
|
-
"@context":
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1786
|
+
var WebAnnotation = import_zod27.z.object({
|
|
1787
|
+
"@context": import_zod27.z.tuple([
|
|
1788
|
+
import_zod27.z.literal("http://www.w3.org/ns/anno.jsonld").describe("W3C Web Annotation Context."),
|
|
1789
|
+
import_zod27.z.literal("https://www.cidoc-crm.org/cidoc-crm/json-ld_context.jsonld").describe("CIDOC Web Annotation Context."),
|
|
1790
|
+
import_zod27.z.literal(contextUri).describe("LINCS Web Annotation Context.")
|
|
1687
1791
|
]).describe(
|
|
1688
1792
|
"The context that determines the meaning of the JSON as an Annotation. The itens should point to a URI containing the defiintion used in this schema."
|
|
1689
1793
|
),
|
|
1690
|
-
id:
|
|
1691
|
-
type:
|
|
1692
|
-
motivation:
|
|
1693
|
-
created:
|
|
1694
|
-
modified:
|
|
1695
|
-
creator: User.describe("The agent responsible for creating the resource.").optional(),
|
|
1696
|
-
contributor:
|
|
1794
|
+
id: import_zod27.z.string().url().describe("The identity of the Annotation."),
|
|
1795
|
+
type: import_zod27.z.tuple([import_zod27.z.literal("Annotation"), import_zod27.z.literal("crm:E33_Linguistic_Object")]).describe("The type of the Annotation."),
|
|
1796
|
+
motivation: import_zod27.z.enum(Motivation).describe("The relationship between an Annotation and a Motivation."),
|
|
1797
|
+
created: import_zod27.z.string().datetime().describe("The time at which the resource was created."),
|
|
1798
|
+
modified: import_zod27.z.string().datetime().optional().describe("The time at which the resource was modified, after creation."),
|
|
1799
|
+
creator: import_zod27.z.union([User, Group, Software]).describe("The agent responsible for creating the resource.").optional(),
|
|
1800
|
+
contributor: import_zod27.z.array(import_zod27.z.union([User, Group, Software])).nonempty().optional().describe("The agents responsible for modifying the resource."),
|
|
1697
1801
|
generator: Software.describe(
|
|
1698
1802
|
"The agent responsible for generating the serialization of the Annotation. "
|
|
1699
1803
|
),
|
|
1700
|
-
target: Target.describe("The relationship between an Annotation and its Target."),
|
|
1701
|
-
body:
|
|
1804
|
+
target: import_zod27.z.union([Target, import_zod27.z.array(Target)]).describe("The relationship between an Annotation and its Target."),
|
|
1805
|
+
body: import_zod27.z.union([BodyChoice, Body, import_zod27.z.array(Body)]).describe("The relationship between an Annotation and its Body."),
|
|
1702
1806
|
certainty: Certainty.optional(),
|
|
1703
1807
|
precision: Precision.optional(),
|
|
1704
|
-
label:
|
|
1705
|
-
P2_has_type:
|
|
1808
|
+
label: import_zod27.z.string().min(1, { message: "The label cannot be empty" }).optional().describe("The descriptive label for the annotation"),
|
|
1809
|
+
P2_has_type: import_zod27.z.union([import_zod27.z.string().min(3), import_zod27.z.array(import_zod27.z.string().min(3)).min(1)]).optional()
|
|
1706
1810
|
}).describe("Web Annotation Root");
|
|
1707
1811
|
var webAnnotationSchema = {
|
|
1708
1812
|
$id: schemaId,
|
|
@@ -1750,16 +1854,38 @@ var webAnnotationSchema = {
|
|
|
1750
1854
|
format: "date-time",
|
|
1751
1855
|
description: "The time at which the resource was modified, after creation."
|
|
1752
1856
|
},
|
|
1753
|
-
creator: {
|
|
1754
|
-
|
|
1857
|
+
creator: {
|
|
1858
|
+
oneOf: [
|
|
1859
|
+
{ $ref: "defs.jsonld#/definitions/user" },
|
|
1860
|
+
{ $ref: "defs.jsonld#/definitions/group" },
|
|
1861
|
+
{ $ref: "defs.jsonld#/definitions/software" }
|
|
1862
|
+
]
|
|
1863
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1864
|
+
},
|
|
1755
1865
|
contributor: {
|
|
1756
1866
|
type: "array",
|
|
1757
|
-
items: {
|
|
1867
|
+
items: {
|
|
1868
|
+
oneOf: [
|
|
1869
|
+
{ $ref: "defs.jsonld#/definitions/user" },
|
|
1870
|
+
{ $ref: "defs.jsonld#/definitions/group" },
|
|
1871
|
+
{ $ref: "defs.jsonld#/definitions/software" }
|
|
1872
|
+
]
|
|
1873
|
+
},
|
|
1758
1874
|
minItems: 1
|
|
1759
1875
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1760
1876
|
},
|
|
1761
1877
|
generator: { $ref: "defs.jsonld#/definitions/software" },
|
|
1762
|
-
target: {
|
|
1878
|
+
target: {
|
|
1879
|
+
oneOf: [
|
|
1880
|
+
{ $ref: "defs.jsonld#/definitions/target" },
|
|
1881
|
+
{
|
|
1882
|
+
type: "array",
|
|
1883
|
+
items: { $ref: "defs.jsonld#/definitions/target" },
|
|
1884
|
+
minItems: 1
|
|
1885
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1886
|
+
}
|
|
1887
|
+
]
|
|
1888
|
+
},
|
|
1763
1889
|
body: {
|
|
1764
1890
|
oneOf: [
|
|
1765
1891
|
{ $ref: "defs.jsonld#/definitions/bodyChoice" },
|
|
@@ -1946,18 +2072,18 @@ var import_ajv = __toESM(require("ajv"));
|
|
|
1946
2072
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1947
2073
|
|
|
1948
2074
|
// src/v1/validator/types.ts
|
|
1949
|
-
var
|
|
1950
|
-
var ValidationError =
|
|
1951
|
-
message:
|
|
1952
|
-
path:
|
|
1953
|
-
suggestion:
|
|
1954
|
-
context:
|
|
1955
|
-
errorType:
|
|
1956
|
-
}).and(
|
|
2075
|
+
var import_zod28 = require("zod");
|
|
2076
|
+
var ValidationError = import_zod28.z.object({
|
|
2077
|
+
message: import_zod28.z.string(),
|
|
2078
|
+
path: import_zod28.z.string(),
|
|
2079
|
+
suggestion: import_zod28.z.string().optional(),
|
|
2080
|
+
context: import_zod28.z.object({
|
|
2081
|
+
errorType: import_zod28.z.string()
|
|
2082
|
+
}).and(import_zod28.z.unknown())
|
|
1957
2083
|
});
|
|
1958
|
-
var ValidateResult =
|
|
1959
|
-
valid:
|
|
1960
|
-
errors:
|
|
2084
|
+
var ValidateResult = import_zod28.z.object({
|
|
2085
|
+
valid: import_zod28.z.boolean(),
|
|
2086
|
+
errors: import_zod28.z.array(ValidationError).optional()
|
|
1961
2087
|
});
|
|
1962
2088
|
|
|
1963
2089
|
// src/v1/validator/index.ts
|
|
@@ -2006,6 +2132,7 @@ __export(v1_exports, {
|
|
|
2006
2132
|
Description: () => Description,
|
|
2007
2133
|
Event: () => Event,
|
|
2008
2134
|
EventEntityType: () => EventEntityType,
|
|
2135
|
+
Group: () => Group,
|
|
2009
2136
|
Keyword: () => Keyword,
|
|
2010
2137
|
KeywordEntityType: () => KeywordEntityType,
|
|
2011
2138
|
KeywordFolksnomy: () => KeywordFolksnomy,
|
|
@@ -2058,7 +2185,6 @@ __export(v1_exports, {
|
|
|
2058
2185
|
contextUri: () => contextUri,
|
|
2059
2186
|
correctionEntityTypeSchema: () => correctionEntityTypeSchema,
|
|
2060
2187
|
correctionSchema: () => correctionSchema,
|
|
2061
|
-
creatorSchema: () => creatorSchema,
|
|
2062
2188
|
dateEntityTypeSchema: () => dateEntityTypeSchema,
|
|
2063
2189
|
dateSchema: () => dateSchema,
|
|
2064
2190
|
definitionSchema: () => definitionSchema,
|
|
@@ -2067,6 +2193,7 @@ __export(v1_exports, {
|
|
|
2067
2193
|
eventEntityTypeSchema: () => eventEntityTypeSchema,
|
|
2068
2194
|
eventSchema: () => eventSchema,
|
|
2069
2195
|
formatSchema: () => formatSchema,
|
|
2196
|
+
groupSchema: () => groupSchema,
|
|
2070
2197
|
isIdentifiedBy: () => isIdentifiedBy,
|
|
2071
2198
|
isIndentifyBySchema: () => isIndentifyBySchema,
|
|
2072
2199
|
keywordEntityTypeSchema: () => keywordEntityTypeSchema,
|
|
@@ -2102,6 +2229,7 @@ __export(v1_exports, {
|
|
|
2102
2229
|
textPositionSelectorSchema: () => textPositionSelectorSchema,
|
|
2103
2230
|
textQuoteSelectorExtendedSchema: () => textQuoteSelectorExtendedSchema,
|
|
2104
2231
|
textQuoteSelectorSchema: () => textQuoteSelectorSchema,
|
|
2232
|
+
userSchema: () => userSchema,
|
|
2105
2233
|
validate: () => validate,
|
|
2106
2234
|
validator: () => validator,
|
|
2107
2235
|
webAnnotationSchema: () => webAnnotationSchema,
|
|
@@ -2128,6 +2256,7 @@ __export(v1_exports, {
|
|
|
2128
2256
|
Description,
|
|
2129
2257
|
Event,
|
|
2130
2258
|
EventEntityType,
|
|
2259
|
+
Group,
|
|
2131
2260
|
Keyword,
|
|
2132
2261
|
KeywordEntityType,
|
|
2133
2262
|
KeywordFolksnomy,
|
|
@@ -2180,7 +2309,6 @@ __export(v1_exports, {
|
|
|
2180
2309
|
contextUri,
|
|
2181
2310
|
correctionEntityTypeSchema,
|
|
2182
2311
|
correctionSchema,
|
|
2183
|
-
creatorSchema,
|
|
2184
2312
|
dateEntityTypeSchema,
|
|
2185
2313
|
dateSchema,
|
|
2186
2314
|
definitionSchema,
|
|
@@ -2189,6 +2317,7 @@ __export(v1_exports, {
|
|
|
2189
2317
|
eventEntityTypeSchema,
|
|
2190
2318
|
eventSchema,
|
|
2191
2319
|
formatSchema,
|
|
2320
|
+
groupSchema,
|
|
2192
2321
|
isIdentifiedBy,
|
|
2193
2322
|
isIndentifyBySchema,
|
|
2194
2323
|
keywordEntityTypeSchema,
|
|
@@ -2224,6 +2353,7 @@ __export(v1_exports, {
|
|
|
2224
2353
|
textPositionSelectorSchema,
|
|
2225
2354
|
textQuoteSelectorExtendedSchema,
|
|
2226
2355
|
textQuoteSelectorSchema,
|
|
2356
|
+
userSchema,
|
|
2227
2357
|
v1,
|
|
2228
2358
|
validate,
|
|
2229
2359
|
validator,
|