@lincs.project/webannotation-schema 1.0.3 → 1.1.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/dist/index.d.mts +28 -58
- package/dist/index.d.ts +28 -58
- package/dist/index.js +177 -116
- package/dist/index.mjs +177 -116
- package/package.json +9 -10
package/dist/index.js
CHANGED
|
@@ -179,7 +179,7 @@ var require_polyfills = __commonJS({
|
|
|
179
179
|
Object.setPrototypeOf(read, fs$read);
|
|
180
180
|
return read;
|
|
181
181
|
}(fs4.read);
|
|
182
|
-
fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : function(fs$readSync) {
|
|
182
|
+
fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : /* @__PURE__ */ function(fs$readSync) {
|
|
183
183
|
return function(fd, buffer, offset, length, position) {
|
|
184
184
|
var eagCounter = 0;
|
|
185
185
|
while (true) {
|
|
@@ -2808,12 +2808,12 @@ var defsId = `https://wa.lincsproject.ca/${VERSION}/defs.jsonld`;
|
|
|
2808
2808
|
var schemaContext = {
|
|
2809
2809
|
"@context": {
|
|
2810
2810
|
bf: "http://www.openlinksw.com/schemas/bif#",
|
|
2811
|
-
cito: "
|
|
2812
|
-
cwrc: "http://id.lincsproject.ca/cwrc
|
|
2813
|
-
edit: "http://id.lincsproject.ca/edit
|
|
2814
|
-
fabio: "https://purl.org/spar/fabio
|
|
2815
|
-
frbroo: "
|
|
2816
|
-
wikidata: "
|
|
2811
|
+
cito: "http://purl.org/spar/cito/",
|
|
2812
|
+
cwrc: "http://id.lincsproject.ca/cwrc/",
|
|
2813
|
+
edit: "http://id.lincsproject.ca/edit/",
|
|
2814
|
+
fabio: "https://purl.org/spar/fabio/",
|
|
2815
|
+
frbroo: "http://iflastandards.info/ns/fr/frbr/frbroo/",
|
|
2816
|
+
wikidata: "http://www.wikidata.org/entity/",
|
|
2817
2817
|
crm: "http://www.cidoc-crm.org/cidoc-crm/",
|
|
2818
2818
|
crmdig: "http://www.ics.forth.gr/isl/CRMdig/",
|
|
2819
2819
|
certainty: {
|
|
@@ -2902,7 +2902,7 @@ var softwareSchema = {
|
|
|
2902
2902
|
};
|
|
2903
2903
|
|
|
2904
2904
|
// src/v1/schema/definitions/body/index.ts
|
|
2905
|
-
var
|
|
2905
|
+
var import_zod16 = require("zod");
|
|
2906
2906
|
|
|
2907
2907
|
// src/v1/schema/definitions/body/citation.ts
|
|
2908
2908
|
var import_zod3 = require("zod");
|
|
@@ -2949,7 +2949,10 @@ var CitationEntityType = import_zod3.z.tuple([
|
|
|
2949
2949
|
import_zod3.z.literal("crm:E73_Information_Object")
|
|
2950
2950
|
]);
|
|
2951
2951
|
var Citation = import_zod3.z.object({
|
|
2952
|
-
id: import_zod3.z.
|
|
2952
|
+
id: import_zod3.z.union([
|
|
2953
|
+
import_zod3.z.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
2954
|
+
import_zod3.z.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
2955
|
+
]),
|
|
2953
2956
|
entityType: import_zod3.z.tuple([import_zod3.z.literal("cito:Citation"), import_zod3.z.literal("crm:E73_Information_Object")]),
|
|
2954
2957
|
certainty: Certainty.optional(),
|
|
2955
2958
|
label: Label.optional(),
|
|
@@ -2975,7 +2978,10 @@ var ConceptualObjectEntityType = import_zod4.z.union([
|
|
|
2975
2978
|
])
|
|
2976
2979
|
]);
|
|
2977
2980
|
var ConceptualObject = import_zod4.z.object({
|
|
2978
|
-
id: import_zod4.z.
|
|
2981
|
+
id: import_zod4.z.union([
|
|
2982
|
+
import_zod4.z.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
2983
|
+
import_zod4.z.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
2984
|
+
]),
|
|
2979
2985
|
entityType: ConceptualObjectEntityType,
|
|
2980
2986
|
certainty: Certainty.optional(),
|
|
2981
2987
|
label: Label.optional(),
|
|
@@ -3046,7 +3052,10 @@ var KeywordEntityType = import_zod7.z.tuple([
|
|
|
3046
3052
|
import_zod7.z.literal("crmdig:D1_Digital_Object")
|
|
3047
3053
|
]);
|
|
3048
3054
|
var Keyword = import_zod7.z.object({
|
|
3049
|
-
id: import_zod7.z.
|
|
3055
|
+
id: import_zod7.z.union([
|
|
3056
|
+
import_zod7.z.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3057
|
+
import_zod7.z.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3058
|
+
]),
|
|
3050
3059
|
entityType: KeywordEntityType,
|
|
3051
3060
|
certainty: Certainty.optional(),
|
|
3052
3061
|
label: Label.optional(),
|
|
@@ -3119,7 +3128,10 @@ var OrganizationEntityType = import_zod10.z.tuple([
|
|
|
3119
3128
|
])
|
|
3120
3129
|
]);
|
|
3121
3130
|
var Organization = import_zod10.z.object({
|
|
3122
|
-
id: import_zod10.z.
|
|
3131
|
+
id: import_zod10.z.union([
|
|
3132
|
+
import_zod10.z.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3133
|
+
import_zod10.z.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3134
|
+
]),
|
|
3123
3135
|
entityType: OrganizationEntityType,
|
|
3124
3136
|
certainty: Certainty.optional(),
|
|
3125
3137
|
label: Label.optional(),
|
|
@@ -3154,7 +3166,10 @@ var PersonEntityType = import_zod11.z.tuple([
|
|
|
3154
3166
|
])
|
|
3155
3167
|
]);
|
|
3156
3168
|
var Person = import_zod11.z.object({
|
|
3157
|
-
id: import_zod11.z.
|
|
3169
|
+
id: import_zod11.z.union([
|
|
3170
|
+
import_zod11.z.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3171
|
+
import_zod11.z.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3172
|
+
]),
|
|
3158
3173
|
entityType: PersonEntityType,
|
|
3159
3174
|
certainty: Certainty.optional(),
|
|
3160
3175
|
label: Label.optional(),
|
|
@@ -3178,7 +3193,12 @@ var personSchema = {
|
|
|
3178
3193
|
type: "object",
|
|
3179
3194
|
description: "A person entity",
|
|
3180
3195
|
properties: {
|
|
3181
|
-
id: {
|
|
3196
|
+
id: {
|
|
3197
|
+
oneOf: [
|
|
3198
|
+
{ type: "string", format: "uri", description: "The IRI that identifies the Body resource" },
|
|
3199
|
+
{ type: "string", format: "uuid" }
|
|
3200
|
+
]
|
|
3201
|
+
},
|
|
3182
3202
|
entityType: personEntityTypeSchema,
|
|
3183
3203
|
certainty: { $ref: "defs.jsonld#/definitions/certainty" },
|
|
3184
3204
|
label: { $ref: "defs.jsonld#/definitions/label" },
|
|
@@ -3198,7 +3218,10 @@ var PhysicalThingEntityType = import_zod12.z.union([
|
|
|
3198
3218
|
])
|
|
3199
3219
|
]);
|
|
3200
3220
|
var PhysicalThing = import_zod12.z.object({
|
|
3201
|
-
id: import_zod12.z.
|
|
3221
|
+
id: import_zod12.z.union([
|
|
3222
|
+
import_zod12.z.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3223
|
+
import_zod12.z.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3224
|
+
]),
|
|
3202
3225
|
entityType: PhysicalThingEntityType,
|
|
3203
3226
|
certainty: Certainty.optional(),
|
|
3204
3227
|
label: Label.optional(),
|
|
@@ -3229,7 +3252,10 @@ var PlaceEntityType = import_zod13.z.union([
|
|
|
3229
3252
|
])
|
|
3230
3253
|
]);
|
|
3231
3254
|
var Place = import_zod13.z.object({
|
|
3232
|
-
id: import_zod13.z.
|
|
3255
|
+
id: import_zod13.z.union([
|
|
3256
|
+
import_zod13.z.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3257
|
+
import_zod13.z.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3258
|
+
]),
|
|
3233
3259
|
entityType: PlaceEntityType,
|
|
3234
3260
|
certainty: Certainty.optional(),
|
|
3235
3261
|
precision: Precision.optional(),
|
|
@@ -3261,7 +3287,10 @@ var WorkEntityType = import_zod14.z.tuple([
|
|
|
3261
3287
|
])
|
|
3262
3288
|
]);
|
|
3263
3289
|
var Work = import_zod14.z.object({
|
|
3264
|
-
id: import_zod14.z.
|
|
3290
|
+
id: import_zod14.z.union([
|
|
3291
|
+
import_zod14.z.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3292
|
+
import_zod14.z.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3293
|
+
]),
|
|
3265
3294
|
entityType: WorkEntityType,
|
|
3266
3295
|
certainty: Certainty.optional(),
|
|
3267
3296
|
label: Label.optional(),
|
|
@@ -3282,15 +3311,33 @@ var workEntityTypeSchema = {
|
|
|
3282
3311
|
]
|
|
3283
3312
|
};
|
|
3284
3313
|
|
|
3285
|
-
// src/v1/schema/definitions/body/
|
|
3286
|
-
var
|
|
3287
|
-
var
|
|
3314
|
+
// src/v1/schema/definitions/body/event.ts
|
|
3315
|
+
var import_zod15 = require("zod");
|
|
3316
|
+
var EventEntityType = import_zod15.z.literal("PLACEHOLDER_FOR_EVENT");
|
|
3317
|
+
var Event = import_zod15.z.object({
|
|
3288
3318
|
id: import_zod15.z.union([
|
|
3289
3319
|
import_zod15.z.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3290
3320
|
import_zod15.z.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3291
3321
|
]),
|
|
3292
|
-
|
|
3293
|
-
|
|
3322
|
+
entityType: EventEntityType,
|
|
3323
|
+
certainty: Certainty.optional(),
|
|
3324
|
+
label: Label.optional(),
|
|
3325
|
+
description: Description.optional()
|
|
3326
|
+
}).describe("Organization");
|
|
3327
|
+
var eventEntityTypeSchema = {
|
|
3328
|
+
type: "string",
|
|
3329
|
+
const: "PLACEHOLDER_FOR_EVENT"
|
|
3330
|
+
};
|
|
3331
|
+
|
|
3332
|
+
// src/v1/schema/definitions/body/index.ts
|
|
3333
|
+
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)?)$";
|
|
3334
|
+
var Body = import_zod16.z.object({
|
|
3335
|
+
id: import_zod16.z.union([
|
|
3336
|
+
import_zod16.z.string().url({ message: "Must be an URI" }).describe("The IRI that identifies the Body resource."),
|
|
3337
|
+
import_zod16.z.string().uuid({ message: "Must be an UUID" }).describe("UUID that identifies the annotation's body.")
|
|
3338
|
+
]),
|
|
3339
|
+
type: import_zod16.z.literal("TextualBody").optional(),
|
|
3340
|
+
entityType: import_zod16.z.union([
|
|
3294
3341
|
PersonEntityType,
|
|
3295
3342
|
PlaceEntityType,
|
|
3296
3343
|
OrganizationEntityType,
|
|
@@ -3303,10 +3350,11 @@ var Body = import_zod15.z.object({
|
|
|
3303
3350
|
CorrectionEntityType,
|
|
3304
3351
|
KeywordEntityType,
|
|
3305
3352
|
KeywordFolksnomyEntityType,
|
|
3306
|
-
LinkEntityType
|
|
3353
|
+
LinkEntityType,
|
|
3354
|
+
EventEntityType
|
|
3307
3355
|
]),
|
|
3308
|
-
additionalType:
|
|
3309
|
-
value:
|
|
3356
|
+
additionalType: import_zod16.z.union([import_zod16.z.string(), import_zod16.z.string().array()]).optional().describe("Extra types that refines the body"),
|
|
3357
|
+
value: import_zod16.z.string().describe("The value of the body").optional(),
|
|
3310
3358
|
certainty: Certainty.optional(),
|
|
3311
3359
|
precision: Precision.optional(),
|
|
3312
3360
|
label: Label.optional(),
|
|
@@ -3337,7 +3385,8 @@ var bodySchema = {
|
|
|
3337
3385
|
correctionEntityTypeSchema,
|
|
3338
3386
|
keywordEntityTypeSchema,
|
|
3339
3387
|
keywordFolksnomyEntityTypeSchema,
|
|
3340
|
-
linkEntityTypeSchema
|
|
3388
|
+
linkEntityTypeSchema,
|
|
3389
|
+
eventEntityTypeSchema
|
|
3341
3390
|
]
|
|
3342
3391
|
},
|
|
3343
3392
|
additionalType: {
|
|
@@ -3452,7 +3501,18 @@ var bodySchema = {
|
|
|
3452
3501
|
},
|
|
3453
3502
|
else: {
|
|
3454
3503
|
type: "object",
|
|
3455
|
-
properties: {
|
|
3504
|
+
properties: {
|
|
3505
|
+
id: {
|
|
3506
|
+
oneOf: [
|
|
3507
|
+
{
|
|
3508
|
+
type: "string",
|
|
3509
|
+
format: "uri",
|
|
3510
|
+
description: "The IRI that identifies the Body resource"
|
|
3511
|
+
},
|
|
3512
|
+
{ type: "string", format: "uuid" }
|
|
3513
|
+
]
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3456
3516
|
}
|
|
3457
3517
|
}
|
|
3458
3518
|
// ? TODO: Add more restrictions
|
|
@@ -3463,21 +3523,21 @@ var bodySchema = {
|
|
|
3463
3523
|
};
|
|
3464
3524
|
|
|
3465
3525
|
// src/v1/schema/definitions/target/index.ts
|
|
3466
|
-
var
|
|
3526
|
+
var import_zod21 = require("zod");
|
|
3467
3527
|
|
|
3468
3528
|
// src/v1/schema/definitions/target/selector/range.ts
|
|
3469
|
-
var
|
|
3529
|
+
var import_zod19 = require("zod");
|
|
3470
3530
|
|
|
3471
3531
|
// src/v1/schema/definitions/target/selector/xpath.ts
|
|
3472
|
-
var
|
|
3532
|
+
var import_zod18 = require("zod");
|
|
3473
3533
|
|
|
3474
3534
|
// src/v1/schema/definitions/target/selector/textPosition.ts
|
|
3475
|
-
var
|
|
3476
|
-
var TextPositionSelector =
|
|
3477
|
-
id:
|
|
3478
|
-
type:
|
|
3479
|
-
start:
|
|
3480
|
-
end:
|
|
3535
|
+
var import_zod17 = require("zod");
|
|
3536
|
+
var TextPositionSelector = import_zod17.z.object({
|
|
3537
|
+
id: import_zod17.z.string().url().describe("The IRI that identifies the target resource."),
|
|
3538
|
+
type: import_zod17.z.tuple([import_zod17.z.literal("TextPositionSelector"), import_zod17.z.literal("crm:E73_Information_Object")]),
|
|
3539
|
+
start: import_zod17.z.number().min(0).describe("The starting position of the segment. The first byte is character position 0."),
|
|
3540
|
+
end: import_zod17.z.number().describe(
|
|
3481
3541
|
"The end position of the segment. The last character is not included within the segment."
|
|
3482
3542
|
)
|
|
3483
3543
|
}).describe("TextPosition Selector");
|
|
@@ -3516,10 +3576,10 @@ var textPositionSelectorSchema = {
|
|
|
3516
3576
|
};
|
|
3517
3577
|
|
|
3518
3578
|
// src/v1/schema/definitions/target/selector/xpath.ts
|
|
3519
|
-
var XpathSelector =
|
|
3520
|
-
id:
|
|
3521
|
-
type:
|
|
3522
|
-
value:
|
|
3579
|
+
var XpathSelector = import_zod18.z.object({
|
|
3580
|
+
id: import_zod18.z.string().uuid().describe("UUID that identifies the selector."),
|
|
3581
|
+
type: import_zod18.z.tuple([import_zod18.z.literal("XPathSelector"), import_zod18.z.literal("crm:E73_Information_Object")]),
|
|
3582
|
+
value: import_zod18.z.string().min(1).describe("The xpath to the selected segment."),
|
|
3523
3583
|
refinedBy: TextPositionSelector.optional().describe(
|
|
3524
3584
|
"The relationship between a broader selector and the more specific selector that should be applied to the results of the first."
|
|
3525
3585
|
)
|
|
@@ -3557,9 +3617,9 @@ var xpathSelectorSchema = {
|
|
|
3557
3617
|
};
|
|
3558
3618
|
|
|
3559
3619
|
// src/v1/schema/definitions/target/selector/range.ts
|
|
3560
|
-
var RangeSelector =
|
|
3561
|
-
id:
|
|
3562
|
-
type:
|
|
3620
|
+
var RangeSelector = import_zod19.z.object({
|
|
3621
|
+
id: import_zod19.z.string().uuid().describe("UUID that identifies the selector."),
|
|
3622
|
+
type: import_zod19.z.tuple([import_zod19.z.literal("RangeSelector"), import_zod19.z.literal("crm:E73_Information_Object")]),
|
|
3563
3623
|
startSelector: XpathSelector,
|
|
3564
3624
|
endSelector: XpathSelector
|
|
3565
3625
|
}).describe("Range Selector");
|
|
@@ -3590,18 +3650,18 @@ var rangeSelectorSchema = {
|
|
|
3590
3650
|
};
|
|
3591
3651
|
|
|
3592
3652
|
// src/v1/schema/definitions/target/selector/textQuote.ts
|
|
3593
|
-
var
|
|
3594
|
-
var TextQuoteSelector =
|
|
3595
|
-
id:
|
|
3596
|
-
type:
|
|
3597
|
-
exact:
|
|
3598
|
-
prefix:
|
|
3653
|
+
var import_zod20 = require("zod");
|
|
3654
|
+
var TextQuoteSelector = import_zod20.z.object({
|
|
3655
|
+
id: import_zod20.z.string().uuid().describe("UUID that identifies the selector."),
|
|
3656
|
+
type: import_zod20.z.tuple([import_zod20.z.literal("TextQuoteSelector"), import_zod20.z.literal("crm:E33_Linguistic_Object")]),
|
|
3657
|
+
exact: import_zod20.z.string().describe("A copy of the text which is being selected, after normalization."),
|
|
3658
|
+
prefix: import_zod20.z.string().optional().describe(
|
|
3599
3659
|
"The snippet of text that occurs immediately before the text which is being selected."
|
|
3600
3660
|
),
|
|
3601
|
-
sufix:
|
|
3661
|
+
sufix: import_zod20.z.string().optional().describe(
|
|
3602
3662
|
"The snippet of text that occurs immediately after the text which is being selected."
|
|
3603
3663
|
),
|
|
3604
|
-
refinedBy:
|
|
3664
|
+
refinedBy: import_zod20.z.union([RangeSelector, XpathSelector, TextPositionSelector]).optional().describe(
|
|
3605
3665
|
"The relationship between a broader selector and the more specific selector that should be applied to the results of the first."
|
|
3606
3666
|
)
|
|
3607
3667
|
}).describe("Quote Selector");
|
|
@@ -3652,28 +3712,28 @@ var textQuoteSelectorSchema = {
|
|
|
3652
3712
|
};
|
|
3653
3713
|
|
|
3654
3714
|
// src/v1/schema/definitions/target/index.ts
|
|
3655
|
-
var Target =
|
|
3656
|
-
id:
|
|
3657
|
-
type:
|
|
3658
|
-
format:
|
|
3659
|
-
|
|
3715
|
+
var Target = import_zod21.z.object({
|
|
3716
|
+
id: import_zod21.z.union([import_zod21.z.string().url(), import_zod21.z.string().uuid()]).describe("The IRI that identifies the Target resource."),
|
|
3717
|
+
type: import_zod21.z.tuple([import_zod21.z.literal("SpecificResource"), import_zod21.z.literal("crm:E73_Information_Object")]).describe("The class of the Specific Resource."),
|
|
3718
|
+
format: import_zod21.z.array(
|
|
3719
|
+
import_zod21.z.string().min(1).describe(
|
|
3660
3720
|
"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."
|
|
3661
3721
|
)
|
|
3662
3722
|
).optional().describe(
|
|
3663
3723
|
"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."
|
|
3664
3724
|
),
|
|
3665
|
-
language:
|
|
3666
|
-
|
|
3725
|
+
language: import_zod21.z.array(
|
|
3726
|
+
import_zod21.z.string().min(2).max(3).describe(
|
|
3667
3727
|
"The language of the Web Resource's content. The value of the property should be a language code following the [bcp47] specification."
|
|
3668
3728
|
)
|
|
3669
3729
|
).min(1).optional().describe(
|
|
3670
3730
|
"The languages of the Web Resource's content. The value of the property should be an array of language code following the [bcp47] specification."
|
|
3671
3731
|
),
|
|
3672
|
-
title:
|
|
3732
|
+
title: import_zod21.z.string().min(1, { message: "The title cannot be empty" }).optional().describe("The title of the document being annotated."),
|
|
3673
3733
|
renderedVia: Software.optional().describe(
|
|
3674
3734
|
"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."
|
|
3675
3735
|
),
|
|
3676
|
-
selector:
|
|
3736
|
+
selector: import_zod21.z.union([TextQuoteSelector, RangeSelector, XpathSelector, TextPositionSelector]).optional().describe("The relationship between a Specific Resource and a Selector. ")
|
|
3677
3737
|
}).describe("Web Annotation Target");
|
|
3678
3738
|
var targetSchema = {
|
|
3679
3739
|
type: "object",
|
|
@@ -3873,7 +3933,7 @@ var definitionSchema = {
|
|
|
3873
3933
|
};
|
|
3874
3934
|
|
|
3875
3935
|
// src/v1/schema/root.ts
|
|
3876
|
-
var
|
|
3936
|
+
var import_zod22 = require("zod");
|
|
3877
3937
|
var Status = ["draft", "approved", "published"];
|
|
3878
3938
|
var Motivation = [
|
|
3879
3939
|
"identifying",
|
|
@@ -3884,32 +3944,32 @@ var Motivation = [
|
|
|
3884
3944
|
"linking",
|
|
3885
3945
|
"citing"
|
|
3886
3946
|
];
|
|
3887
|
-
var WebAnnotation =
|
|
3888
|
-
"@context":
|
|
3889
|
-
|
|
3890
|
-
|
|
3947
|
+
var WebAnnotation = import_zod22.z.object({
|
|
3948
|
+
"@context": import_zod22.z.tuple([
|
|
3949
|
+
import_zod22.z.literal("http://www.w3.org/ns/anno.jsonld").describe("W3C Web Annotation Context."),
|
|
3950
|
+
import_zod22.z.literal(contextUri).describe("LINCS Web Annotation Context.")
|
|
3891
3951
|
]).describe(
|
|
3892
3952
|
"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."
|
|
3893
3953
|
),
|
|
3894
|
-
id:
|
|
3895
|
-
|
|
3954
|
+
id: import_zod22.z.union([
|
|
3955
|
+
import_zod22.z.string().url(),
|
|
3896
3956
|
//? We can improve this making it a regexp to make sure that this URI contains a search params named 'annoID' with n UUID value".])
|
|
3897
|
-
|
|
3957
|
+
import_zod22.z.string().uuid()
|
|
3898
3958
|
]).describe(
|
|
3899
3959
|
"The identity of the Annotation. It must be a UUID or URI containing a UUID in the search params (URI?annoId=URI)"
|
|
3900
3960
|
),
|
|
3901
|
-
type:
|
|
3902
|
-
motivation:
|
|
3903
|
-
created:
|
|
3904
|
-
modified:
|
|
3905
|
-
status:
|
|
3961
|
+
type: import_zod22.z.tuple([import_zod22.z.literal("Annotation"), import_zod22.z.literal("crm:E33_Linguistic_Object")]).describe("The type of the Annotation."),
|
|
3962
|
+
motivation: import_zod22.z.tuple([import_zod22.z.enum(Motivation), import_zod22.z.literal("crm:E55_Type")]).describe("The relationship between an Annotation and a Motivation."),
|
|
3963
|
+
created: import_zod22.z.string().datetime().describe("The time at which the resource was created."),
|
|
3964
|
+
modified: import_zod22.z.string().datetime().optional().describe("The time at which the resource was modified, after creation."),
|
|
3965
|
+
status: import_zod22.z.enum(Status).describe("The status of this annotation in a workflow."),
|
|
3906
3966
|
creator: User.describe("The agent responsible for creating the resource.").optional(),
|
|
3907
|
-
contributor:
|
|
3967
|
+
contributor: import_zod22.z.array(User.describe("The agents responsible for modifying the resource.")).nonempty().optional().describe("The agents responsible for modifying the resource."),
|
|
3908
3968
|
generator: Software.describe(
|
|
3909
3969
|
"The agent responsible for generating the serialization of the Annotation. "
|
|
3910
3970
|
),
|
|
3911
3971
|
target: Target.describe("The relationship between an Annotation and its Target."),
|
|
3912
|
-
body:
|
|
3972
|
+
body: import_zod22.z.union([Body, import_zod22.z.array(Body)]).describe("The relationship between an Annotation and its Body.")
|
|
3913
3973
|
}).describe("Web Annotation Root");
|
|
3914
3974
|
var webAnnotationSchema = {
|
|
3915
3975
|
$id: schemaId,
|
|
@@ -3953,7 +4013,7 @@ var webAnnotationSchema = {
|
|
|
3953
4013
|
maxItems: 2,
|
|
3954
4014
|
items: [
|
|
3955
4015
|
{ type: "string", enum: Motivation },
|
|
3956
|
-
{ type: "string", const: "crm:
|
|
4016
|
+
{ type: "string", const: "crm:E55_Type" }
|
|
3957
4017
|
],
|
|
3958
4018
|
description: "The relationship between an Annotation and a Motivation."
|
|
3959
4019
|
},
|
|
@@ -4039,7 +4099,8 @@ var webAnnotationSchema = {
|
|
|
4039
4099
|
workEntityTypeSchema,
|
|
4040
4100
|
physicalThingEntityTypeSchema,
|
|
4041
4101
|
conceptualObjectEntityTypeSchema,
|
|
4042
|
-
dateEntityTypeSchema
|
|
4102
|
+
dateEntityTypeSchema,
|
|
4103
|
+
eventEntityTypeSchema
|
|
4043
4104
|
]
|
|
4044
4105
|
}
|
|
4045
4106
|
}
|
|
@@ -4055,7 +4116,7 @@ var webAnnotationSchema = {
|
|
|
4055
4116
|
maxItems: 2,
|
|
4056
4117
|
items: [
|
|
4057
4118
|
{ type: "string", const: "identifying" },
|
|
4058
|
-
{ type: "string", const: "crm:
|
|
4119
|
+
{ type: "string", const: "crm:E55_Type" }
|
|
4059
4120
|
]
|
|
4060
4121
|
}
|
|
4061
4122
|
}
|
|
@@ -4081,7 +4142,7 @@ var webAnnotationSchema = {
|
|
|
4081
4142
|
maxItems: 2,
|
|
4082
4143
|
items: [
|
|
4083
4144
|
{ type: "string", const: "describing" },
|
|
4084
|
-
{ type: "string", const: "crm:
|
|
4145
|
+
{ type: "string", const: "crm:E55_Type" }
|
|
4085
4146
|
]
|
|
4086
4147
|
}
|
|
4087
4148
|
}
|
|
@@ -4107,7 +4168,7 @@ var webAnnotationSchema = {
|
|
|
4107
4168
|
maxItems: 2,
|
|
4108
4169
|
items: [
|
|
4109
4170
|
{ type: "string", const: "correcting" },
|
|
4110
|
-
{ type: "string", const: "crm:
|
|
4171
|
+
{ type: "string", const: "crm:E55_Type" }
|
|
4111
4172
|
]
|
|
4112
4173
|
}
|
|
4113
4174
|
}
|
|
@@ -4133,7 +4194,7 @@ var webAnnotationSchema = {
|
|
|
4133
4194
|
maxItems: 2,
|
|
4134
4195
|
items: [
|
|
4135
4196
|
{ type: "string", const: "tagging" },
|
|
4136
|
-
{ type: "string", const: "crm:
|
|
4197
|
+
{ type: "string", const: "crm:E55_Type" }
|
|
4137
4198
|
]
|
|
4138
4199
|
}
|
|
4139
4200
|
}
|
|
@@ -4159,7 +4220,7 @@ var webAnnotationSchema = {
|
|
|
4159
4220
|
maxItems: 2,
|
|
4160
4221
|
items: [
|
|
4161
4222
|
{ type: "string", const: "classifying" },
|
|
4162
|
-
{ type: "string", const: "crm:
|
|
4223
|
+
{ type: "string", const: "crm:E55_Type" }
|
|
4163
4224
|
]
|
|
4164
4225
|
}
|
|
4165
4226
|
}
|
|
@@ -4185,7 +4246,7 @@ var webAnnotationSchema = {
|
|
|
4185
4246
|
maxItems: 2,
|
|
4186
4247
|
items: [
|
|
4187
4248
|
{ type: "string", const: "linking" },
|
|
4188
|
-
{ type: "string", const: "crm:
|
|
4249
|
+
{ type: "string", const: "crm:E55_Type" }
|
|
4189
4250
|
]
|
|
4190
4251
|
}
|
|
4191
4252
|
}
|
|
@@ -4211,7 +4272,7 @@ var webAnnotationSchema = {
|
|
|
4211
4272
|
maxItems: 2,
|
|
4212
4273
|
items: [
|
|
4213
4274
|
{ type: "string", const: "citing" },
|
|
4214
|
-
{ type: "string", const: "crm:
|
|
4275
|
+
{ type: "string", const: "crm:E55_Type" }
|
|
4215
4276
|
]
|
|
4216
4277
|
}
|
|
4217
4278
|
}
|
|
@@ -4233,18 +4294,18 @@ var import_ajv = __toESM(require("ajv"));
|
|
|
4233
4294
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
4234
4295
|
|
|
4235
4296
|
// src/v1/validator/types.ts
|
|
4236
|
-
var
|
|
4237
|
-
var ValidationError =
|
|
4238
|
-
message:
|
|
4239
|
-
path:
|
|
4240
|
-
suggestion:
|
|
4241
|
-
context:
|
|
4242
|
-
errorType:
|
|
4243
|
-
}).and(
|
|
4297
|
+
var import_zod23 = require("zod");
|
|
4298
|
+
var ValidationError = import_zod23.z.object({
|
|
4299
|
+
message: import_zod23.z.string(),
|
|
4300
|
+
path: import_zod23.z.string(),
|
|
4301
|
+
suggestion: import_zod23.z.string().optional(),
|
|
4302
|
+
context: import_zod23.z.object({
|
|
4303
|
+
errorType: import_zod23.z.string()
|
|
4304
|
+
}).and(import_zod23.z.unknown())
|
|
4244
4305
|
});
|
|
4245
|
-
var ValidateResult =
|
|
4246
|
-
valid:
|
|
4247
|
-
errors:
|
|
4306
|
+
var ValidateResult = import_zod23.z.object({
|
|
4307
|
+
valid: import_zod23.z.boolean(),
|
|
4308
|
+
errors: import_zod23.z.array(ValidationError).optional()
|
|
4248
4309
|
});
|
|
4249
4310
|
|
|
4250
4311
|
// src/v1/validator/index.ts
|
|
@@ -4467,7 +4528,7 @@ var commonAnnotation = {
|
|
|
4467
4528
|
"@context": ["http://www.w3.org/ns/anno.jsonld", "https://wa.lincsproject.ca/v1/ns/anno.jsonld"],
|
|
4468
4529
|
id: "c7aa1b38-6364-483c-8607-44dc3f510a59",
|
|
4469
4530
|
type: ["Annotation", "crm:E33_Linguistic_Object"],
|
|
4470
|
-
motivation: ["identifying", "crm:
|
|
4531
|
+
motivation: ["identifying", "crm:E55_Type"],
|
|
4471
4532
|
created: "2022-12-21T23:21:02Z",
|
|
4472
4533
|
creator: commonCreator,
|
|
4473
4534
|
generator: commonSoftware,
|
|
@@ -4591,7 +4652,7 @@ var place = {
|
|
|
4591
4652
|
// src/v1/mocks/body/citation.ts
|
|
4592
4653
|
var simple = {
|
|
4593
4654
|
...common.annotation,
|
|
4594
|
-
motivation: ["citing", "crm:
|
|
4655
|
+
motivation: ["citing", "crm:E55_Type"],
|
|
4595
4656
|
body: {
|
|
4596
4657
|
id: "https://www.uo.com/conceptualObject",
|
|
4597
4658
|
entityType: ["cito:Citation", "crm:E73_Information_Object"]
|
|
@@ -4599,7 +4660,7 @@ var simple = {
|
|
|
4599
4660
|
};
|
|
4600
4661
|
var withCertainty3 = {
|
|
4601
4662
|
...common.annotation,
|
|
4602
|
-
motivation: ["citing", "crm:
|
|
4663
|
+
motivation: ["citing", "crm:E55_Type"],
|
|
4603
4664
|
body: {
|
|
4604
4665
|
id: "https://www.uo.com/conceptualObject",
|
|
4605
4666
|
entityType: ["cito:Citation", "crm:E73_Information_Object"],
|
|
@@ -4608,7 +4669,7 @@ var withCertainty3 = {
|
|
|
4608
4669
|
};
|
|
4609
4670
|
var withLabelAndDescription3 = {
|
|
4610
4671
|
...common.annotation,
|
|
4611
|
-
motivation: ["citing", "crm:
|
|
4672
|
+
motivation: ["citing", "crm:E55_Type"],
|
|
4612
4673
|
body: {
|
|
4613
4674
|
id: "https://www.uo.com/conceptualObject",
|
|
4614
4675
|
entityType: ["cito:Citation", "crm:E73_Information_Object"],
|
|
@@ -4668,7 +4729,7 @@ var conceptualObject = {
|
|
|
4668
4729
|
// src/v1/mocks/body/correction.ts
|
|
4669
4730
|
var valid = {
|
|
4670
4731
|
...common.annotation,
|
|
4671
|
-
motivation: ["correcting", "crm:
|
|
4732
|
+
motivation: ["correcting", "crm:E55_Type"],
|
|
4672
4733
|
body: {
|
|
4673
4734
|
id: "55369c00-5c43-4d1a-8462-31c74fbec584",
|
|
4674
4735
|
type: "TextualBody",
|
|
@@ -4721,7 +4782,7 @@ var date = {
|
|
|
4721
4782
|
// src/v1/mocks/body/keyword.ts
|
|
4722
4783
|
var vocabularySimple = {
|
|
4723
4784
|
...common.annotation,
|
|
4724
|
-
motivation: ["classifying", "crm:
|
|
4785
|
+
motivation: ["classifying", "crm:E55_Type"],
|
|
4725
4786
|
body: {
|
|
4726
4787
|
id: "https://www.uo.com/keyword",
|
|
4727
4788
|
entityType: ["crm:E55_Type", "crmdig:D1_Digital_Object"]
|
|
@@ -4729,7 +4790,7 @@ var vocabularySimple = {
|
|
|
4729
4790
|
};
|
|
4730
4791
|
var vocabularyWithCertainty = {
|
|
4731
4792
|
...common.annotation,
|
|
4732
|
-
motivation: ["classifying", "crm:
|
|
4793
|
+
motivation: ["classifying", "crm:E55_Type"],
|
|
4733
4794
|
body: {
|
|
4734
4795
|
id: "https://www.uo.com/keyword",
|
|
4735
4796
|
entityType: ["crm:E55_Type", "crmdig:D1_Digital_Object"],
|
|
@@ -4738,7 +4799,7 @@ var vocabularyWithCertainty = {
|
|
|
4738
4799
|
};
|
|
4739
4800
|
var vocabularyWithLabelAndDescription = {
|
|
4740
4801
|
...common.annotation,
|
|
4741
|
-
motivation: ["classifying", "crm:
|
|
4802
|
+
motivation: ["classifying", "crm:E55_Type"],
|
|
4742
4803
|
body: {
|
|
4743
4804
|
id: "https://www.uo.com/keyword",
|
|
4744
4805
|
entityType: ["crm:E55_Type", "crmdig:D1_Digital_Object"],
|
|
@@ -4748,7 +4809,7 @@ var vocabularyWithLabelAndDescription = {
|
|
|
4748
4809
|
};
|
|
4749
4810
|
var folksonomy = {
|
|
4750
4811
|
...common.annotation,
|
|
4751
|
-
motivation: ["tagging", "crm:
|
|
4812
|
+
motivation: ["tagging", "crm:E55_Type"],
|
|
4752
4813
|
body: {
|
|
4753
4814
|
id: "55369c00-5c43-4d1a-8462-31c74fbec584",
|
|
4754
4815
|
type: "TextualBody",
|
|
@@ -4770,7 +4831,7 @@ var keyword = {
|
|
|
4770
4831
|
// src/v1/mocks/body/link.ts
|
|
4771
4832
|
var simple3 = {
|
|
4772
4833
|
...common.annotation,
|
|
4773
|
-
motivation: ["linking", "crm:
|
|
4834
|
+
motivation: ["linking", "crm:E55_Type"],
|
|
4774
4835
|
body: {
|
|
4775
4836
|
id: "https://www.uo.com/link",
|
|
4776
4837
|
entityType: "crmdig:D1_Digital_Object"
|
|
@@ -4778,7 +4839,7 @@ var simple3 = {
|
|
|
4778
4839
|
};
|
|
4779
4840
|
var withCertainty6 = {
|
|
4780
4841
|
...common.annotation,
|
|
4781
|
-
motivation: ["linking", "crm:
|
|
4842
|
+
motivation: ["linking", "crm:E55_Type"],
|
|
4782
4843
|
body: {
|
|
4783
4844
|
id: "https://www.uo.com/link",
|
|
4784
4845
|
entityType: "crmdig:D1_Digital_Object",
|
|
@@ -4795,7 +4856,7 @@ var link = {
|
|
|
4795
4856
|
// src/v1/mocks/body/note.ts
|
|
4796
4857
|
var simple4 = {
|
|
4797
4858
|
...common.annotation,
|
|
4798
|
-
motivation: ["describing", "crm:
|
|
4859
|
+
motivation: ["describing", "crm:E55_Type"],
|
|
4799
4860
|
body: {
|
|
4800
4861
|
id: "55369c00-5c43-4d1a-8462-31c74fbec584",
|
|
4801
4862
|
type: "TextualBody",
|
|
@@ -4805,7 +4866,7 @@ var simple4 = {
|
|
|
4805
4866
|
};
|
|
4806
4867
|
var additionalType = {
|
|
4807
4868
|
...common.annotation,
|
|
4808
|
-
motivation: ["describing", "crm:
|
|
4869
|
+
motivation: ["describing", "crm:E55_Type"],
|
|
4809
4870
|
body: {
|
|
4810
4871
|
id: "55369c00-5c43-4d1a-8462-31c74fbec584",
|
|
4811
4872
|
type: "TextualBody",
|
|
@@ -4816,7 +4877,7 @@ var additionalType = {
|
|
|
4816
4877
|
};
|
|
4817
4878
|
var additionalMultipleTypes = {
|
|
4818
4879
|
...common.annotation,
|
|
4819
|
-
motivation: ["describing", "crm:
|
|
4880
|
+
motivation: ["describing", "crm:E55_Type"],
|
|
4820
4881
|
body: {
|
|
4821
4882
|
id: "55369c00-5c43-4d1a-8462-31c74fbec584",
|
|
4822
4883
|
type: "TextualBody",
|
|
@@ -5021,12 +5082,12 @@ var idUUID = {
|
|
|
5021
5082
|
};
|
|
5022
5083
|
var motivationIdentify = {
|
|
5023
5084
|
...common.annotation,
|
|
5024
|
-
motivation: ["identifying", "crm:
|
|
5085
|
+
motivation: ["identifying", "crm:E55_Type"],
|
|
5025
5086
|
body: commonPersonBody
|
|
5026
5087
|
};
|
|
5027
5088
|
var motivationDescribing = {
|
|
5028
5089
|
...common.annotation,
|
|
5029
|
-
motivation: ["describing", "crm:
|
|
5090
|
+
motivation: ["describing", "crm:E55_Type"],
|
|
5030
5091
|
body: {
|
|
5031
5092
|
id: "55369c00-5c43-4d1a-8462-31c74fbec584",
|
|
5032
5093
|
type: "TextualBody",
|
|
@@ -5036,7 +5097,7 @@ var motivationDescribing = {
|
|
|
5036
5097
|
};
|
|
5037
5098
|
var motivationCorrecting = {
|
|
5038
5099
|
...common.annotation,
|
|
5039
|
-
motivation: ["correcting", "crm:
|
|
5100
|
+
motivation: ["correcting", "crm:E55_Type"],
|
|
5040
5101
|
body: {
|
|
5041
5102
|
id: "55369c00-5c43-4d1a-8462-31c74fbec584",
|
|
5042
5103
|
type: "TextualBody",
|
|
@@ -5046,7 +5107,7 @@ var motivationCorrecting = {
|
|
|
5046
5107
|
};
|
|
5047
5108
|
var motivationTagging = {
|
|
5048
5109
|
...common.annotation,
|
|
5049
|
-
motivation: ["tagging", "crm:
|
|
5110
|
+
motivation: ["tagging", "crm:E55_Type"],
|
|
5050
5111
|
body: {
|
|
5051
5112
|
id: "55369c00-5c43-4d1a-8462-31c74fbec584",
|
|
5052
5113
|
type: "TextualBody",
|
|
@@ -5056,7 +5117,7 @@ var motivationTagging = {
|
|
|
5056
5117
|
};
|
|
5057
5118
|
var motivationClassifying = {
|
|
5058
5119
|
...common.annotation,
|
|
5059
|
-
motivation: ["classifying", "crm:
|
|
5120
|
+
motivation: ["classifying", "crm:E55_Type"],
|
|
5060
5121
|
body: {
|
|
5061
5122
|
id: "https://www.uo.com/keyword",
|
|
5062
5123
|
entityType: ["crm:E55_Type", "crmdig:D1_Digital_Object"]
|
|
@@ -5064,7 +5125,7 @@ var motivationClassifying = {
|
|
|
5064
5125
|
};
|
|
5065
5126
|
var motivationLinking = {
|
|
5066
5127
|
...common.annotation,
|
|
5067
|
-
motivation: ["linking", "crm:
|
|
5128
|
+
motivation: ["linking", "crm:E55_Type"],
|
|
5068
5129
|
body: {
|
|
5069
5130
|
id: "https://www.uo.com/link",
|
|
5070
5131
|
entityType: "crmdig:D1_Digital_Object"
|
|
@@ -5072,7 +5133,7 @@ var motivationLinking = {
|
|
|
5072
5133
|
};
|
|
5073
5134
|
var motivationCiting = {
|
|
5074
5135
|
...common.annotation,
|
|
5075
|
-
motivation: ["citing", "crm:
|
|
5136
|
+
motivation: ["citing", "crm:E55_Type"],
|
|
5076
5137
|
body: {
|
|
5077
5138
|
id: "https://www.uo.com/conceptualObject",
|
|
5078
5139
|
entityType: ["cito:Citation", "crm:E73_Information_Object"]
|