@lincs.project/webannotation-schema 1.0.3 → 1.1.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 +24 -54
- package/dist/index.d.ts +24 -54
- package/dist/index.js +148 -87
- package/dist/index.mjs +148 -87
- package/package.json +9 -10
package/dist/index.mjs
CHANGED
|
@@ -184,7 +184,7 @@ var require_polyfills = __commonJS({
|
|
|
184
184
|
Object.setPrototypeOf(read, fs$read);
|
|
185
185
|
return read;
|
|
186
186
|
}(fs4.read);
|
|
187
|
-
fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : function(fs$readSync) {
|
|
187
|
+
fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : /* @__PURE__ */ function(fs$readSync) {
|
|
188
188
|
return function(fd, buffer, offset, length, position) {
|
|
189
189
|
var eagCounter = 0;
|
|
190
190
|
while (true) {
|
|
@@ -2779,12 +2779,12 @@ var defsId = `https://wa.lincsproject.ca/${VERSION}/defs.jsonld`;
|
|
|
2779
2779
|
var schemaContext = {
|
|
2780
2780
|
"@context": {
|
|
2781
2781
|
bf: "http://www.openlinksw.com/schemas/bif#",
|
|
2782
|
-
cito: "
|
|
2783
|
-
cwrc: "http://id.lincsproject.ca/cwrc
|
|
2784
|
-
edit: "http://id.lincsproject.ca/edit
|
|
2785
|
-
fabio: "https://purl.org/spar/fabio
|
|
2786
|
-
frbroo: "
|
|
2787
|
-
wikidata: "
|
|
2782
|
+
cito: "http://purl.org/spar/cito/",
|
|
2783
|
+
cwrc: "http://id.lincsproject.ca/cwrc/",
|
|
2784
|
+
edit: "http://id.lincsproject.ca/edit/",
|
|
2785
|
+
fabio: "https://purl.org/spar/fabio/",
|
|
2786
|
+
frbroo: "http://iflastandards.info/ns/fr/frbr/frbroo/",
|
|
2787
|
+
wikidata: "http://www.wikidata.org/entity/",
|
|
2788
2788
|
crm: "http://www.cidoc-crm.org/cidoc-crm/",
|
|
2789
2789
|
crmdig: "http://www.ics.forth.gr/isl/CRMdig/",
|
|
2790
2790
|
certainty: {
|
|
@@ -2873,7 +2873,7 @@ var softwareSchema = {
|
|
|
2873
2873
|
};
|
|
2874
2874
|
|
|
2875
2875
|
// src/v1/schema/definitions/body/index.ts
|
|
2876
|
-
import { z as
|
|
2876
|
+
import { z as z16 } from "zod";
|
|
2877
2877
|
|
|
2878
2878
|
// src/v1/schema/definitions/body/citation.ts
|
|
2879
2879
|
import { z as z3 } from "zod";
|
|
@@ -2920,7 +2920,10 @@ var CitationEntityType = z3.tuple([
|
|
|
2920
2920
|
z3.literal("crm:E73_Information_Object")
|
|
2921
2921
|
]);
|
|
2922
2922
|
var Citation = z3.object({
|
|
2923
|
-
id: z3.
|
|
2923
|
+
id: z3.union([
|
|
2924
|
+
z3.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
2925
|
+
z3.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
2926
|
+
]),
|
|
2924
2927
|
entityType: z3.tuple([z3.literal("cito:Citation"), z3.literal("crm:E73_Information_Object")]),
|
|
2925
2928
|
certainty: Certainty.optional(),
|
|
2926
2929
|
label: Label.optional(),
|
|
@@ -2946,7 +2949,10 @@ var ConceptualObjectEntityType = z4.union([
|
|
|
2946
2949
|
])
|
|
2947
2950
|
]);
|
|
2948
2951
|
var ConceptualObject = z4.object({
|
|
2949
|
-
id: z4.
|
|
2952
|
+
id: z4.union([
|
|
2953
|
+
z4.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
2954
|
+
z4.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
2955
|
+
]),
|
|
2950
2956
|
entityType: ConceptualObjectEntityType,
|
|
2951
2957
|
certainty: Certainty.optional(),
|
|
2952
2958
|
label: Label.optional(),
|
|
@@ -3017,7 +3023,10 @@ var KeywordEntityType = z7.tuple([
|
|
|
3017
3023
|
z7.literal("crmdig:D1_Digital_Object")
|
|
3018
3024
|
]);
|
|
3019
3025
|
var Keyword = z7.object({
|
|
3020
|
-
id: z7.
|
|
3026
|
+
id: z7.union([
|
|
3027
|
+
z7.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3028
|
+
z7.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3029
|
+
]),
|
|
3021
3030
|
entityType: KeywordEntityType,
|
|
3022
3031
|
certainty: Certainty.optional(),
|
|
3023
3032
|
label: Label.optional(),
|
|
@@ -3090,7 +3099,10 @@ var OrganizationEntityType = z10.tuple([
|
|
|
3090
3099
|
])
|
|
3091
3100
|
]);
|
|
3092
3101
|
var Organization = z10.object({
|
|
3093
|
-
id: z10.
|
|
3102
|
+
id: z10.union([
|
|
3103
|
+
z10.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3104
|
+
z10.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3105
|
+
]),
|
|
3094
3106
|
entityType: OrganizationEntityType,
|
|
3095
3107
|
certainty: Certainty.optional(),
|
|
3096
3108
|
label: Label.optional(),
|
|
@@ -3125,7 +3137,10 @@ var PersonEntityType = z11.tuple([
|
|
|
3125
3137
|
])
|
|
3126
3138
|
]);
|
|
3127
3139
|
var Person = z11.object({
|
|
3128
|
-
id: z11.
|
|
3140
|
+
id: z11.union([
|
|
3141
|
+
z11.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3142
|
+
z11.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3143
|
+
]),
|
|
3129
3144
|
entityType: PersonEntityType,
|
|
3130
3145
|
certainty: Certainty.optional(),
|
|
3131
3146
|
label: Label.optional(),
|
|
@@ -3149,7 +3164,12 @@ var personSchema = {
|
|
|
3149
3164
|
type: "object",
|
|
3150
3165
|
description: "A person entity",
|
|
3151
3166
|
properties: {
|
|
3152
|
-
id: {
|
|
3167
|
+
id: {
|
|
3168
|
+
oneOf: [
|
|
3169
|
+
{ type: "string", format: "uri", description: "The IRI that identifies the Body resource" },
|
|
3170
|
+
{ type: "string", format: "uuid" }
|
|
3171
|
+
]
|
|
3172
|
+
},
|
|
3153
3173
|
entityType: personEntityTypeSchema,
|
|
3154
3174
|
certainty: { $ref: "defs.jsonld#/definitions/certainty" },
|
|
3155
3175
|
label: { $ref: "defs.jsonld#/definitions/label" },
|
|
@@ -3169,7 +3189,10 @@ var PhysicalThingEntityType = z12.union([
|
|
|
3169
3189
|
])
|
|
3170
3190
|
]);
|
|
3171
3191
|
var PhysicalThing = z12.object({
|
|
3172
|
-
id: z12.
|
|
3192
|
+
id: z12.union([
|
|
3193
|
+
z12.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3194
|
+
z12.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3195
|
+
]),
|
|
3173
3196
|
entityType: PhysicalThingEntityType,
|
|
3174
3197
|
certainty: Certainty.optional(),
|
|
3175
3198
|
label: Label.optional(),
|
|
@@ -3200,7 +3223,10 @@ var PlaceEntityType = z13.union([
|
|
|
3200
3223
|
])
|
|
3201
3224
|
]);
|
|
3202
3225
|
var Place = z13.object({
|
|
3203
|
-
id: z13.
|
|
3226
|
+
id: z13.union([
|
|
3227
|
+
z13.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3228
|
+
z13.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3229
|
+
]),
|
|
3204
3230
|
entityType: PlaceEntityType,
|
|
3205
3231
|
certainty: Certainty.optional(),
|
|
3206
3232
|
precision: Precision.optional(),
|
|
@@ -3232,7 +3258,10 @@ var WorkEntityType = z14.tuple([
|
|
|
3232
3258
|
])
|
|
3233
3259
|
]);
|
|
3234
3260
|
var Work = z14.object({
|
|
3235
|
-
id: z14.
|
|
3261
|
+
id: z14.union([
|
|
3262
|
+
z14.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3263
|
+
z14.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3264
|
+
]),
|
|
3236
3265
|
entityType: WorkEntityType,
|
|
3237
3266
|
certainty: Certainty.optional(),
|
|
3238
3267
|
label: Label.optional(),
|
|
@@ -3253,15 +3282,33 @@ var workEntityTypeSchema = {
|
|
|
3253
3282
|
]
|
|
3254
3283
|
};
|
|
3255
3284
|
|
|
3256
|
-
// src/v1/schema/definitions/body/
|
|
3257
|
-
|
|
3258
|
-
var
|
|
3285
|
+
// src/v1/schema/definitions/body/event.ts
|
|
3286
|
+
import { z as z15 } from "zod";
|
|
3287
|
+
var EventEntityType = z15.literal("PLACEHOLDER_FOR_EVENT");
|
|
3288
|
+
var Event = z15.object({
|
|
3259
3289
|
id: z15.union([
|
|
3260
3290
|
z15.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3261
3291
|
z15.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3262
3292
|
]),
|
|
3263
|
-
|
|
3264
|
-
|
|
3293
|
+
entityType: EventEntityType,
|
|
3294
|
+
certainty: Certainty.optional(),
|
|
3295
|
+
label: Label.optional(),
|
|
3296
|
+
description: Description.optional()
|
|
3297
|
+
}).describe("Organization");
|
|
3298
|
+
var eventEntityTypeSchema = {
|
|
3299
|
+
type: "string",
|
|
3300
|
+
const: "PLACEHOLDER_FOR_EVENT"
|
|
3301
|
+
};
|
|
3302
|
+
|
|
3303
|
+
// src/v1/schema/definitions/body/index.ts
|
|
3304
|
+
var DATE_PATTERN = "^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}(?:.\\d*)?)((-(\\d{2}):(\\d{2})|Z)?)\\/(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}(?:.\\d*)?)((-(\\d{2}):(\\d{2})|Z)?)$";
|
|
3305
|
+
var Body = z16.object({
|
|
3306
|
+
id: z16.union([
|
|
3307
|
+
z16.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3308
|
+
z16.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3309
|
+
]),
|
|
3310
|
+
type: z16.literal("TextualBody").optional(),
|
|
3311
|
+
entityType: z16.union([
|
|
3265
3312
|
PersonEntityType,
|
|
3266
3313
|
PlaceEntityType,
|
|
3267
3314
|
OrganizationEntityType,
|
|
@@ -3274,10 +3321,11 @@ var Body = z15.object({
|
|
|
3274
3321
|
CorrectionEntityType,
|
|
3275
3322
|
KeywordEntityType,
|
|
3276
3323
|
KeywordFolksnomyEntityType,
|
|
3277
|
-
LinkEntityType
|
|
3324
|
+
LinkEntityType,
|
|
3325
|
+
EventEntityType
|
|
3278
3326
|
]),
|
|
3279
|
-
additionalType:
|
|
3280
|
-
value:
|
|
3327
|
+
additionalType: z16.union([z16.string(), z16.string().array()]).optional().describe("Extra types that refines the body"),
|
|
3328
|
+
value: z16.string().describe("The value of the body").optional(),
|
|
3281
3329
|
certainty: Certainty.optional(),
|
|
3282
3330
|
precision: Precision.optional(),
|
|
3283
3331
|
label: Label.optional(),
|
|
@@ -3308,7 +3356,8 @@ var bodySchema = {
|
|
|
3308
3356
|
correctionEntityTypeSchema,
|
|
3309
3357
|
keywordEntityTypeSchema,
|
|
3310
3358
|
keywordFolksnomyEntityTypeSchema,
|
|
3311
|
-
linkEntityTypeSchema
|
|
3359
|
+
linkEntityTypeSchema,
|
|
3360
|
+
eventEntityTypeSchema
|
|
3312
3361
|
]
|
|
3313
3362
|
},
|
|
3314
3363
|
additionalType: {
|
|
@@ -3423,7 +3472,18 @@ var bodySchema = {
|
|
|
3423
3472
|
},
|
|
3424
3473
|
else: {
|
|
3425
3474
|
type: "object",
|
|
3426
|
-
properties: {
|
|
3475
|
+
properties: {
|
|
3476
|
+
id: {
|
|
3477
|
+
oneOf: [
|
|
3478
|
+
{
|
|
3479
|
+
type: "string",
|
|
3480
|
+
format: "uri",
|
|
3481
|
+
description: "The IRI that identifies the Body resource"
|
|
3482
|
+
},
|
|
3483
|
+
{ type: "string", format: "uuid" }
|
|
3484
|
+
]
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3427
3487
|
}
|
|
3428
3488
|
}
|
|
3429
3489
|
// ? TODO: Add more restrictions
|
|
@@ -3434,21 +3494,21 @@ var bodySchema = {
|
|
|
3434
3494
|
};
|
|
3435
3495
|
|
|
3436
3496
|
// src/v1/schema/definitions/target/index.ts
|
|
3437
|
-
import { z as
|
|
3497
|
+
import { z as z21 } from "zod";
|
|
3438
3498
|
|
|
3439
3499
|
// src/v1/schema/definitions/target/selector/range.ts
|
|
3440
|
-
import { z as
|
|
3500
|
+
import { z as z19 } from "zod";
|
|
3441
3501
|
|
|
3442
3502
|
// src/v1/schema/definitions/target/selector/xpath.ts
|
|
3443
|
-
import { z as
|
|
3503
|
+
import { z as z18 } from "zod";
|
|
3444
3504
|
|
|
3445
3505
|
// src/v1/schema/definitions/target/selector/textPosition.ts
|
|
3446
|
-
import { z as
|
|
3447
|
-
var TextPositionSelector =
|
|
3448
|
-
id:
|
|
3449
|
-
type:
|
|
3450
|
-
start:
|
|
3451
|
-
end:
|
|
3506
|
+
import { z as z17 } from "zod";
|
|
3507
|
+
var TextPositionSelector = z17.object({
|
|
3508
|
+
id: z17.string().url().describe("The IRI that identifies the target resource."),
|
|
3509
|
+
type: z17.tuple([z17.literal("TextPositionSelector"), z17.literal("crm:E73_Information_Object")]),
|
|
3510
|
+
start: z17.number().min(0).describe("The starting position of the segment. The first byte is character position 0."),
|
|
3511
|
+
end: z17.number().describe(
|
|
3452
3512
|
"The end position of the segment. The last character is not included within the segment."
|
|
3453
3513
|
)
|
|
3454
3514
|
}).describe("TextPosition Selector");
|
|
@@ -3487,10 +3547,10 @@ var textPositionSelectorSchema = {
|
|
|
3487
3547
|
};
|
|
3488
3548
|
|
|
3489
3549
|
// src/v1/schema/definitions/target/selector/xpath.ts
|
|
3490
|
-
var XpathSelector =
|
|
3491
|
-
id:
|
|
3492
|
-
type:
|
|
3493
|
-
value:
|
|
3550
|
+
var XpathSelector = z18.object({
|
|
3551
|
+
id: z18.string().uuid().describe("UUID that identifies the selector."),
|
|
3552
|
+
type: z18.tuple([z18.literal("XPathSelector"), z18.literal("crm:E73_Information_Object")]),
|
|
3553
|
+
value: z18.string().min(1).describe("The xpath to the selected segment."),
|
|
3494
3554
|
refinedBy: TextPositionSelector.optional().describe(
|
|
3495
3555
|
"The relationship between a broader selector and the more specific selector that should be applied to the results of the first."
|
|
3496
3556
|
)
|
|
@@ -3528,9 +3588,9 @@ var xpathSelectorSchema = {
|
|
|
3528
3588
|
};
|
|
3529
3589
|
|
|
3530
3590
|
// src/v1/schema/definitions/target/selector/range.ts
|
|
3531
|
-
var RangeSelector =
|
|
3532
|
-
id:
|
|
3533
|
-
type:
|
|
3591
|
+
var RangeSelector = z19.object({
|
|
3592
|
+
id: z19.string().uuid().describe("UUID that identifies the selector."),
|
|
3593
|
+
type: z19.tuple([z19.literal("RangeSelector"), z19.literal("crm:E73_Information_Object")]),
|
|
3534
3594
|
startSelector: XpathSelector,
|
|
3535
3595
|
endSelector: XpathSelector
|
|
3536
3596
|
}).describe("Range Selector");
|
|
@@ -3561,18 +3621,18 @@ var rangeSelectorSchema = {
|
|
|
3561
3621
|
};
|
|
3562
3622
|
|
|
3563
3623
|
// src/v1/schema/definitions/target/selector/textQuote.ts
|
|
3564
|
-
import { z as
|
|
3565
|
-
var TextQuoteSelector =
|
|
3566
|
-
id:
|
|
3567
|
-
type:
|
|
3568
|
-
exact:
|
|
3569
|
-
prefix:
|
|
3624
|
+
import { z as z20 } from "zod";
|
|
3625
|
+
var TextQuoteSelector = z20.object({
|
|
3626
|
+
id: z20.string().uuid().describe("UUID that identifies the selector."),
|
|
3627
|
+
type: z20.tuple([z20.literal("TextQuoteSelector"), z20.literal("crm:E33_Linguistic_Object")]),
|
|
3628
|
+
exact: z20.string().describe("A copy of the text which is being selected, after normalization."),
|
|
3629
|
+
prefix: z20.string().optional().describe(
|
|
3570
3630
|
"The snippet of text that occurs immediately before the text which is being selected."
|
|
3571
3631
|
),
|
|
3572
|
-
sufix:
|
|
3632
|
+
sufix: z20.string().optional().describe(
|
|
3573
3633
|
"The snippet of text that occurs immediately after the text which is being selected."
|
|
3574
3634
|
),
|
|
3575
|
-
refinedBy:
|
|
3635
|
+
refinedBy: z20.union([RangeSelector, XpathSelector, TextPositionSelector]).optional().describe(
|
|
3576
3636
|
"The relationship between a broader selector and the more specific selector that should be applied to the results of the first."
|
|
3577
3637
|
)
|
|
3578
3638
|
}).describe("Quote Selector");
|
|
@@ -3623,28 +3683,28 @@ var textQuoteSelectorSchema = {
|
|
|
3623
3683
|
};
|
|
3624
3684
|
|
|
3625
3685
|
// src/v1/schema/definitions/target/index.ts
|
|
3626
|
-
var Target =
|
|
3627
|
-
id:
|
|
3628
|
-
type:
|
|
3629
|
-
format:
|
|
3630
|
-
|
|
3686
|
+
var Target = z21.object({
|
|
3687
|
+
id: z21.union([z21.string().url(), z21.string().uuid()]).describe("The IRI that identifies the Target resource."),
|
|
3688
|
+
type: z21.tuple([z21.literal("SpecificResource"), z21.literal("crm:E73_Information_Object")]).describe("The class of the Specific Resource."),
|
|
3689
|
+
format: z21.array(
|
|
3690
|
+
z21.string().min(1).describe(
|
|
3631
3691
|
"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."
|
|
3632
3692
|
)
|
|
3633
3693
|
).optional().describe(
|
|
3634
3694
|
"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."
|
|
3635
3695
|
),
|
|
3636
|
-
language:
|
|
3637
|
-
|
|
3696
|
+
language: z21.array(
|
|
3697
|
+
z21.string().min(2).max(3).describe(
|
|
3638
3698
|
"The language of the Web Resource's content. The value of the property should be a language code following the [bcp47] specification."
|
|
3639
3699
|
)
|
|
3640
3700
|
).min(1).optional().describe(
|
|
3641
3701
|
"The languages of the Web Resource's content. The value of the property should be an array of language code following the [bcp47] specification."
|
|
3642
3702
|
),
|
|
3643
|
-
title:
|
|
3703
|
+
title: z21.string().min(1, { message: "The title cannot be empty" }).optional().describe("The title of the document being annotated."),
|
|
3644
3704
|
renderedVia: Software.optional().describe(
|
|
3645
3705
|
"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."
|
|
3646
3706
|
),
|
|
3647
|
-
selector:
|
|
3707
|
+
selector: z21.union([TextQuoteSelector, RangeSelector, XpathSelector, TextPositionSelector]).optional().describe("The relationship between a Specific Resource and a Selector. ")
|
|
3648
3708
|
}).describe("Web Annotation Target");
|
|
3649
3709
|
var targetSchema = {
|
|
3650
3710
|
type: "object",
|
|
@@ -3844,7 +3904,7 @@ var definitionSchema = {
|
|
|
3844
3904
|
};
|
|
3845
3905
|
|
|
3846
3906
|
// src/v1/schema/root.ts
|
|
3847
|
-
import { z as
|
|
3907
|
+
import { z as z22 } from "zod";
|
|
3848
3908
|
var Status = ["draft", "approved", "published"];
|
|
3849
3909
|
var Motivation = [
|
|
3850
3910
|
"identifying",
|
|
@@ -3855,32 +3915,32 @@ var Motivation = [
|
|
|
3855
3915
|
"linking",
|
|
3856
3916
|
"citing"
|
|
3857
3917
|
];
|
|
3858
|
-
var WebAnnotation =
|
|
3859
|
-
"@context":
|
|
3860
|
-
|
|
3861
|
-
|
|
3918
|
+
var WebAnnotation = z22.object({
|
|
3919
|
+
"@context": z22.tuple([
|
|
3920
|
+
z22.literal("http://www.w3.org/ns/anno.jsonld").describe("W3C Web Annotation Context."),
|
|
3921
|
+
z22.literal(contextUri).describe("LINCS Web Annotation Context.")
|
|
3862
3922
|
]).describe(
|
|
3863
3923
|
"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."
|
|
3864
3924
|
),
|
|
3865
|
-
id:
|
|
3866
|
-
|
|
3925
|
+
id: z22.union([
|
|
3926
|
+
z22.string().url(),
|
|
3867
3927
|
//? We can improve this making it a regexp to make sure that this URI contains a search params named 'annoID' with n UUID value".])
|
|
3868
|
-
|
|
3928
|
+
z22.string().uuid()
|
|
3869
3929
|
]).describe(
|
|
3870
3930
|
"The identity of the Annotation. It must be a UUID or URI containing a UUID in the search params (URI?annoId=URI)"
|
|
3871
3931
|
),
|
|
3872
|
-
type:
|
|
3873
|
-
motivation:
|
|
3874
|
-
created:
|
|
3875
|
-
modified:
|
|
3876
|
-
status:
|
|
3932
|
+
type: z22.tuple([z22.literal("Annotation"), z22.literal("crm:E33_Linguistic_Object")]).describe("The type of the Annotation."),
|
|
3933
|
+
motivation: z22.tuple([z22.enum(Motivation), z22.literal("crm:E33_Linguistic_Object")]).describe("The relationship between an Annotation and a Motivation."),
|
|
3934
|
+
created: z22.string().datetime().describe("The time at which the resource was created."),
|
|
3935
|
+
modified: z22.string().datetime().optional().describe("The time at which the resource was modified, after creation."),
|
|
3936
|
+
status: z22.enum(Status).describe("The status of this annotation in a workflow."),
|
|
3877
3937
|
creator: User.describe("The agent responsible for creating the resource.").optional(),
|
|
3878
|
-
contributor:
|
|
3938
|
+
contributor: z22.array(User.describe("The agents responsible for modifying the resource.")).nonempty().optional().describe("The agents responsible for modifying the resource."),
|
|
3879
3939
|
generator: Software.describe(
|
|
3880
3940
|
"The agent responsible for generating the serialization of the Annotation. "
|
|
3881
3941
|
),
|
|
3882
3942
|
target: Target.describe("The relationship between an Annotation and its Target."),
|
|
3883
|
-
body:
|
|
3943
|
+
body: z22.union([Body, z22.array(Body)]).describe("The relationship between an Annotation and its Body.")
|
|
3884
3944
|
}).describe("Web Annotation Root");
|
|
3885
3945
|
var webAnnotationSchema = {
|
|
3886
3946
|
$id: schemaId,
|
|
@@ -4010,7 +4070,8 @@ var webAnnotationSchema = {
|
|
|
4010
4070
|
workEntityTypeSchema,
|
|
4011
4071
|
physicalThingEntityTypeSchema,
|
|
4012
4072
|
conceptualObjectEntityTypeSchema,
|
|
4013
|
-
dateEntityTypeSchema
|
|
4073
|
+
dateEntityTypeSchema,
|
|
4074
|
+
eventEntityTypeSchema
|
|
4014
4075
|
]
|
|
4015
4076
|
}
|
|
4016
4077
|
}
|
|
@@ -4204,18 +4265,18 @@ import Ajv from "ajv";
|
|
|
4204
4265
|
import addFormats from "ajv-formats";
|
|
4205
4266
|
|
|
4206
4267
|
// src/v1/validator/types.ts
|
|
4207
|
-
import { z as
|
|
4208
|
-
var ValidationError =
|
|
4209
|
-
message:
|
|
4210
|
-
path:
|
|
4211
|
-
suggestion:
|
|
4212
|
-
context:
|
|
4213
|
-
errorType:
|
|
4214
|
-
}).and(
|
|
4268
|
+
import { z as z23 } from "zod";
|
|
4269
|
+
var ValidationError = z23.object({
|
|
4270
|
+
message: z23.string(),
|
|
4271
|
+
path: z23.string(),
|
|
4272
|
+
suggestion: z23.string().optional(),
|
|
4273
|
+
context: z23.object({
|
|
4274
|
+
errorType: z23.string()
|
|
4275
|
+
}).and(z23.unknown())
|
|
4215
4276
|
});
|
|
4216
|
-
var ValidateResult =
|
|
4217
|
-
valid:
|
|
4218
|
-
errors:
|
|
4277
|
+
var ValidateResult = z23.object({
|
|
4278
|
+
valid: z23.boolean(),
|
|
4279
|
+
errors: z23.array(ValidationError).optional()
|
|
4219
4280
|
});
|
|
4220
4281
|
|
|
4221
4282
|
// src/v1/validator/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincs.project/webannotation-schema",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "lincs project web annotation json-ld schema",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lincs project",
|
|
@@ -58,23 +58,22 @@
|
|
|
58
58
|
"@apideck/better-ajv-errors": "^0.3.6",
|
|
59
59
|
"ajv": "^8.12.0",
|
|
60
60
|
"ajv-formats": "^2.1.1",
|
|
61
|
-
"typescript": "^5.
|
|
61
|
+
"typescript": "^5.3.2",
|
|
62
62
|
"zod": "^3.22.4"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@jest/globals": "^29.7.0",
|
|
66
|
-
"@types/fs-extra": "^11.0.
|
|
67
|
-
"@types/jest": "^29.5.
|
|
68
|
-
"@types/node": "^20.
|
|
69
|
-
"eslint": "^8.
|
|
66
|
+
"@types/fs-extra": "^11.0.4",
|
|
67
|
+
"@types/jest": "^29.5.11",
|
|
68
|
+
"@types/node": "^20.10.3",
|
|
69
|
+
"eslint": "^8.55.0",
|
|
70
70
|
"eslint-config-custom": "*",
|
|
71
|
-
"fs-extra": "^11.
|
|
71
|
+
"fs-extra": "^11.2.0",
|
|
72
72
|
"jest": "^29.7.0",
|
|
73
73
|
"kleur": "^4.1.5",
|
|
74
74
|
"ts-jest": "^29.1.1",
|
|
75
75
|
"ts-node": "^10.9.1",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"typedoc": "^0.25.3"
|
|
76
|
+
"tsup": "^8.0.1",
|
|
77
|
+
"typedoc": "^0.25.4"
|
|
79
78
|
}
|
|
80
79
|
}
|