@lincs.project/webannotation-schema 1.0.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/LICENSE +661 -0
- package/README.md +155 -0
- package/dist/context.jsonld +24 -0
- package/dist/defs.jsonld +949 -0
- package/dist/schema.jsonld +621 -0
- package/dist/validate.js +1 -0
- package/lib/index.d.ts +145 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +13 -0
- package/lib/index.js.map +1 -0
- package/lib/schema/config.d.ts +4 -0
- package/lib/schema/config.d.ts.map +1 -0
- package/lib/schema/config.js +4 -0
- package/lib/schema/config.js.map +1 -0
- package/lib/schema/context.d.ts +25 -0
- package/lib/schema/context.d.ts.map +1 -0
- package/lib/schema/context.js +25 -0
- package/lib/schema/context.js.map +1 -0
- package/lib/schema/definitions/agent.d.ts +36 -0
- package/lib/schema/definitions/agent.d.ts.map +1 -0
- package/lib/schema/definitions/agent.js +82 -0
- package/lib/schema/definitions/agent.js.map +1 -0
- package/lib/schema/definitions/body/citation.d.ts +27 -0
- package/lib/schema/definitions/body/citation.d.ts.map +1 -0
- package/lib/schema/definitions/body/citation.js +53 -0
- package/lib/schema/definitions/body/citation.js.map +1 -0
- package/lib/schema/definitions/body/common.d.ts +17 -0
- package/lib/schema/definitions/body/common.d.ts.map +1 -0
- package/lib/schema/definitions/body/common.js +46 -0
- package/lib/schema/definitions/body/common.js.map +1 -0
- package/lib/schema/definitions/body/conceptualObject.d.ts +27 -0
- package/lib/schema/definitions/body/conceptualObject.d.ts.map +1 -0
- package/lib/schema/definitions/body/conceptualObject.js +61 -0
- package/lib/schema/definitions/body/conceptualObject.js.map +1 -0
- package/lib/schema/definitions/body/correction.d.ts +24 -0
- package/lib/schema/definitions/body/correction.d.ts.map +1 -0
- package/lib/schema/definitions/body/correction.js +54 -0
- package/lib/schema/definitions/body/correction.js.map +1 -0
- package/lib/schema/definitions/body/date.d.ts +30 -0
- package/lib/schema/definitions/body/date.d.ts.map +1 -0
- package/lib/schema/definitions/body/date.js +61 -0
- package/lib/schema/definitions/body/date.js.map +1 -0
- package/lib/schema/definitions/body/index.d.ts +37 -0
- package/lib/schema/definitions/body/index.d.ts.map +1 -0
- package/lib/schema/definitions/body/index.js +220 -0
- package/lib/schema/definitions/body/index.js.map +1 -0
- package/lib/schema/definitions/body/keyword.d.ts +48 -0
- package/lib/schema/definitions/body/keyword.d.ts.map +1 -0
- package/lib/schema/definitions/body/keyword.js +100 -0
- package/lib/schema/definitions/body/keyword.js.map +1 -0
- package/lib/schema/definitions/body/link.d.ts +21 -0
- package/lib/schema/definitions/body/link.d.ts.map +1 -0
- package/lib/schema/definitions/body/link.js +37 -0
- package/lib/schema/definitions/body/link.js.map +1 -0
- package/lib/schema/definitions/body/note.d.ts +27 -0
- package/lib/schema/definitions/body/note.d.ts.map +1 -0
- package/lib/schema/definitions/body/note.js +54 -0
- package/lib/schema/definitions/body/note.js.map +1 -0
- package/lib/schema/definitions/body/organization.d.ts +27 -0
- package/lib/schema/definitions/body/organization.d.ts.map +1 -0
- package/lib/schema/definitions/body/organization.js +65 -0
- package/lib/schema/definitions/body/organization.js.map +1 -0
- package/lib/schema/definitions/body/person.d.ts +27 -0
- package/lib/schema/definitions/body/person.d.ts.map +1 -0
- package/lib/schema/definitions/body/person.js +61 -0
- package/lib/schema/definitions/body/person.js.map +1 -0
- package/lib/schema/definitions/body/physicalThing.d.ts +27 -0
- package/lib/schema/definitions/body/physicalThing.d.ts.map +1 -0
- package/lib/schema/definitions/body/physicalThing.js +61 -0
- package/lib/schema/definitions/body/physicalThing.js.map +1 -0
- package/lib/schema/definitions/body/place.d.ts +30 -0
- package/lib/schema/definitions/body/place.d.ts.map +1 -0
- package/lib/schema/definitions/body/place.js +64 -0
- package/lib/schema/definitions/body/place.js.map +1 -0
- package/lib/schema/definitions/body/work.d.ts +27 -0
- package/lib/schema/definitions/body/work.d.ts.map +1 -0
- package/lib/schema/definitions/body/work.js +61 -0
- package/lib/schema/definitions/body/work.js.map +1 -0
- package/lib/schema/definitions/index.d.ts +22 -0
- package/lib/schema/definitions/index.d.ts.map +1 -0
- package/lib/schema/definitions/index.js +24 -0
- package/lib/schema/definitions/index.js.map +1 -0
- package/lib/schema/definitions/target/index.d.ts +710 -0
- package/lib/schema/definitions/target/index.d.ts.map +1 -0
- package/lib/schema/definitions/target/index.js +231 -0
- package/lib/schema/definitions/target/index.js.map +1 -0
- package/lib/schema/definitions/target/selector/index.d.ts +5 -0
- package/lib/schema/definitions/target/selector/index.d.ts.map +1 -0
- package/lib/schema/definitions/target/selector/index.js +5 -0
- package/lib/schema/definitions/target/selector/index.js.map +1 -0
- package/lib/schema/definitions/target/selector/range.d.ts +141 -0
- package/lib/schema/definitions/target/selector/range.d.ts.map +1 -0
- package/lib/schema/definitions/target/selector/range.js +44 -0
- package/lib/schema/definitions/target/selector/range.js.map +1 -0
- package/lib/schema/definitions/target/selector/textPosition.d.ts +21 -0
- package/lib/schema/definitions/target/selector/textPosition.d.ts.map +1 -0
- package/lib/schema/definitions/target/selector/textPosition.js +57 -0
- package/lib/schema/definitions/target/selector/textPosition.js.map +1 -0
- package/lib/schema/definitions/target/selector/textQuote.d.ts +297 -0
- package/lib/schema/definitions/target/selector/textQuote.d.ts.map +1 -0
- package/lib/schema/definitions/target/selector/textQuote.js +78 -0
- package/lib/schema/definitions/target/selector/textQuote.js.map +1 -0
- package/lib/schema/definitions/target/selector/xpath.d.ts +46 -0
- package/lib/schema/definitions/target/selector/xpath.d.ts.map +1 -0
- package/lib/schema/definitions/target/selector/xpath.js +51 -0
- package/lib/schema/definitions/target/selector/xpath.js.map +1 -0
- package/lib/schema/index.d.ts +5 -0
- package/lib/schema/index.d.ts.map +1 -0
- package/lib/schema/index.js +5 -0
- package/lib/schema/index.js.map +1 -0
- package/lib/schema/root.d.ts +1076 -0
- package/lib/schema/root.d.ts.map +1 -0
- package/lib/schema/root.js +408 -0
- package/lib/schema/root.js.map +1 -0
- package/lib/validation.d.ts +25 -0
- package/lib/validation.d.ts.map +1 -0
- package/lib/validation.js +35 -0
- package/lib/validation.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Certainty, Description, Label } from './common';
|
|
3
|
+
// * Pure Typescript Type - Just for reference
|
|
4
|
+
// export interface ConceptualObject {
|
|
5
|
+
// id: string;
|
|
6
|
+
// entityType: 'crm:E28_Conceptual_Object' | ['crm:E28_Conceptual_Object', 'wikidata:Q15831596'];
|
|
7
|
+
// certainty?: string;
|
|
8
|
+
// label?: string;
|
|
9
|
+
// description?: string;
|
|
10
|
+
// }
|
|
11
|
+
// * Property: entityType - Type using Zod & Inference
|
|
12
|
+
export const ConceptualObjectEntityType = z.union([
|
|
13
|
+
z.literal('crm:E28_Conceptual_Object'),
|
|
14
|
+
z.tuple([
|
|
15
|
+
z.literal('crm:E28_Conceptual_Object'),
|
|
16
|
+
z.literal('wikidata:Q15831596').describe('Fictional Conceptual Object'),
|
|
17
|
+
]),
|
|
18
|
+
]);
|
|
19
|
+
// * Type using Zod & Inference
|
|
20
|
+
export const ConceptualObject = z
|
|
21
|
+
.object({
|
|
22
|
+
id: z
|
|
23
|
+
.string()
|
|
24
|
+
.url({ message: 'Must be an URI' })
|
|
25
|
+
.describe('The IRI that identifies the Body resource.'),
|
|
26
|
+
entityType: ConceptualObjectEntityType,
|
|
27
|
+
certainty: Certainty.optional(),
|
|
28
|
+
label: Label.optional(),
|
|
29
|
+
description: Description.optional(),
|
|
30
|
+
})
|
|
31
|
+
.describe('Conceptual Object');
|
|
32
|
+
// * JSONSchema - entityType
|
|
33
|
+
export const conceptualObjectEntityTypeSchema = {
|
|
34
|
+
oneOf: [
|
|
35
|
+
{ type: 'string', const: 'crm:E28_Conceptual_Object' },
|
|
36
|
+
{
|
|
37
|
+
type: 'array',
|
|
38
|
+
minItems: 2,
|
|
39
|
+
maxItems: 2,
|
|
40
|
+
items: [
|
|
41
|
+
{ type: 'string', const: 'crm:E28_Conceptual_Object' },
|
|
42
|
+
{ type: 'string', const: 'wikidata:Q15831596', description: 'Fictional Conceptual Object' },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
// * JSONSchema
|
|
48
|
+
export const conceptualObjectSchema = {
|
|
49
|
+
type: 'object',
|
|
50
|
+
description: 'A conceptual object entity',
|
|
51
|
+
properties: {
|
|
52
|
+
id: { type: 'string', format: 'uri', description: 'The IRI that identifies the Body resource' },
|
|
53
|
+
entityType: conceptualObjectEntityTypeSchema,
|
|
54
|
+
certainty: { $ref: 'defs.jsonld#/definitions/certainty' },
|
|
55
|
+
label: { $ref: 'defs.jsonld#/definitions/label' },
|
|
56
|
+
description: { $ref: 'defs.jsonld#/definitions/description' },
|
|
57
|
+
},
|
|
58
|
+
required: ['id', 'entityType'],
|
|
59
|
+
// errorMessage: { properties: { id: 'Must be an URI' } },
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=conceptualObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conceptualObject.js","sourceRoot":"","sources":["../../../../src/schema/definitions/body/conceptualObject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEzD,8CAA8C;AAE9C,sCAAsC;AACtC,gBAAgB;AAChB,mGAAmG;AACnG,wBAAwB;AACxB,oBAAoB;AACpB,0BAA0B;AAC1B,IAAI;AAEJ,sDAAsD;AAEtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC;IAChD,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC;IACtC,CAAC,CAAC,KAAK,CAAC;QACN,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC;QACtC,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,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AgC,EAAE;QACjD,WAAW,EAAE,EAAE,IAAI,EAAE,sCAAsC,EAAE;KAC9D;IACD,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC;IAC9B,0DAA0D;CAC3D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const CorrectionEntityType: z.ZodTuple<[z.ZodLiteral<"fabio:Correction">, z.ZodLiteral<"crm:E33_Linguistic_Object">], null>;
|
|
4
|
+
export type CorrectionEntityType = z.infer<typeof CorrectionEntityType>;
|
|
5
|
+
export declare const Correction: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
type: z.ZodLiteral<"TextualBody">;
|
|
8
|
+
entityType: z.ZodTuple<[z.ZodLiteral<"fabio:Correction">, z.ZodLiteral<"crm:E33_Linguistic_Object">], null>;
|
|
9
|
+
value: z.ZodString;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
value: string;
|
|
12
|
+
type: "TextualBody";
|
|
13
|
+
id: string;
|
|
14
|
+
entityType: ["fabio:Correction", "crm:E33_Linguistic_Object"];
|
|
15
|
+
}, {
|
|
16
|
+
value: string;
|
|
17
|
+
type: "TextualBody";
|
|
18
|
+
id: string;
|
|
19
|
+
entityType: ["fabio:Correction", "crm:E33_Linguistic_Object"];
|
|
20
|
+
}>;
|
|
21
|
+
export type Correction = z.infer<typeof Correction>;
|
|
22
|
+
export declare const correctionEntityTypeSchema: JSONSchemaType<CorrectionEntityType>;
|
|
23
|
+
export declare const correctionSchema: JSONSchemaType<Correction>;
|
|
24
|
+
//# sourceMappingURL=correction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correction.d.ts","sourceRoot":"","sources":["../../../../src/schema/definitions/body/correction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,oBAAoB,iGAG/B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIxE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;EAUE,CAAC;AAE1B,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAIpD,eAAO,MAAM,0BAA0B,EAAE,cAAc,CAAC,oBAAoB,CAQ3E,CAAC;AAIF,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,UAAU,CAgBvD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// * Pure Typescript Type - Just for reference
|
|
3
|
+
// export interface Correction {
|
|
4
|
+
// id: string;
|
|
5
|
+
// type: 'TextualBody';
|
|
6
|
+
// entityType: ['fabio:Correction', 'crm:E33_Linguistic_Object'];
|
|
7
|
+
// value: string;
|
|
8
|
+
// }
|
|
9
|
+
// * Property: entityType - Type using Zod & Inference
|
|
10
|
+
export const CorrectionEntityType = z.tuple([
|
|
11
|
+
z.literal('fabio:Correction'),
|
|
12
|
+
z.literal('crm:E33_Linguistic_Object'),
|
|
13
|
+
]);
|
|
14
|
+
// * Type using Zod & Inference
|
|
15
|
+
export const Correction = z
|
|
16
|
+
.object({
|
|
17
|
+
id: z
|
|
18
|
+
.string()
|
|
19
|
+
.uuid({ message: 'Must be an UUID' })
|
|
20
|
+
.describe("UUID that identifies the annotation's body."),
|
|
21
|
+
type: z.literal('TextualBody'),
|
|
22
|
+
entityType: CorrectionEntityType,
|
|
23
|
+
value: z.string().describe('The correction.'),
|
|
24
|
+
})
|
|
25
|
+
.describe('Correction');
|
|
26
|
+
// * JSONSchema - entityType
|
|
27
|
+
export const correctionEntityTypeSchema = {
|
|
28
|
+
type: 'array',
|
|
29
|
+
minItems: 2,
|
|
30
|
+
maxItems: 2,
|
|
31
|
+
items: [
|
|
32
|
+
{ type: 'string', const: 'fabio:Correction' },
|
|
33
|
+
{ type: 'string', const: 'crm:E33_Linguistic_Object' },
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
// * JSONSchema
|
|
37
|
+
export const correctionSchema = {
|
|
38
|
+
type: 'object',
|
|
39
|
+
description: 'A correction entity',
|
|
40
|
+
properties: {
|
|
41
|
+
id: { type: 'string', format: 'uuid' },
|
|
42
|
+
type: { type: 'string', const: 'TextualBody' },
|
|
43
|
+
entityType: correctionEntityTypeSchema,
|
|
44
|
+
value: { type: 'string' },
|
|
45
|
+
},
|
|
46
|
+
required: ['id', 'type', 'entityType', 'value'],
|
|
47
|
+
// errorMessage: {
|
|
48
|
+
// properties: {
|
|
49
|
+
// id: 'Must be an UUID',
|
|
50
|
+
// type: 'must be exacty "TextualBody"',
|
|
51
|
+
// },
|
|
52
|
+
// },
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=correction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correction.js","sourceRoot":"","sources":["../../../../src/schema/definitions/body/correction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8CAA8C;AAE9C,gCAAgC;AAChC,gBAAgB;AAChB,yBAAyB;AACzB,mEAAmE;AACnE,mBAAmB;AACnB,IAAI;AAEJ,sDAAsD;AAEtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC1C,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAC7B,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC;CACvC,CAAC,CAAC;AAIH,+BAA+B;AAE/B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,CAAC;IACN,EAAE,EAAE,CAAC;SACF,MAAM,EAAE;SACR,IAAI,CAAC,EAAE,OAAO,EAAE,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"crm:E52_Time-Span">], null>;
|
|
4
|
+
export type DateEntityType = z.infer<typeof DateEntityType>;
|
|
5
|
+
export declare const Date: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
type: z.ZodLiteral<"TextualBody">;
|
|
8
|
+
entityType: z.ZodTuple<[z.ZodLiteral<"xsd:date">, z.ZodLiteral<"crm:E52_Time-Span">], null>;
|
|
9
|
+
value: z.ZodString;
|
|
10
|
+
certainty: z.ZodOptional<z.ZodEnum<["edit:qualityLow", "edit:qualityMedium", "edit:qualityHigh", "edit:qualityUnknown"]>>;
|
|
11
|
+
precision: z.ZodOptional<z.ZodEnum<["edit:qualityLow", "edit:qualityMedium", "edit:qualityHigh", "edit:qualityUnknown"]>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
value: string;
|
|
14
|
+
type: "TextualBody";
|
|
15
|
+
id: string;
|
|
16
|
+
entityType: ["xsd:date", "crm:E52_Time-Span"];
|
|
17
|
+
certainty?: "edit:qualityLow" | "edit:qualityMedium" | "edit:qualityHigh" | "edit:qualityUnknown" | undefined;
|
|
18
|
+
precision?: "edit:qualityLow" | "edit:qualityMedium" | "edit:qualityHigh" | "edit:qualityUnknown" | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
value: string;
|
|
21
|
+
type: "TextualBody";
|
|
22
|
+
id: string;
|
|
23
|
+
entityType: ["xsd:date", "crm:E52_Time-Span"];
|
|
24
|
+
certainty?: "edit:qualityLow" | "edit:qualityMedium" | "edit:qualityHigh" | "edit:qualityUnknown" | undefined;
|
|
25
|
+
precision?: "edit:qualityLow" | "edit:qualityMedium" | "edit:qualityHigh" | "edit:qualityUnknown" | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export type Date = z.infer<typeof Date>;
|
|
28
|
+
export declare const dateEntityTypeSchema: JSONSchemaType<DateEntityType>;
|
|
29
|
+
export declare const dateSchema: JSONSchemaType<Date>;
|
|
30
|
+
//# sourceMappingURL=date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../../src/schema/definitions/body/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,eAAO,MAAM,cAAc,iFAAmE,CAAC;AAE/F,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAI5D,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;EAeE,CAAC;AAEpB,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAIxC,eAAO,MAAM,oBAAoB,EAAE,cAAc,CAAC,cAAc,CAQ/D,CAAC;AAIF,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,IAAI,CAkB3C,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Certainty, Precision } from './common';
|
|
3
|
+
// * Pure Typescript Type - Just for reference
|
|
4
|
+
// export interface Date {
|
|
5
|
+
// id: string;
|
|
6
|
+
// type: 'TextualBody';
|
|
7
|
+
// entityType: ['xsd:date', 'crm:E52_Time-Span'];
|
|
8
|
+
// value: string;
|
|
9
|
+
// certainty?: string;
|
|
10
|
+
// precision?: string;
|
|
11
|
+
// }
|
|
12
|
+
// * Property: entityType - Type using Zod & Inference
|
|
13
|
+
export const DateEntityType = z.tuple([z.literal('xsd:date'), z.literal('crm:E52_Time-Span')]);
|
|
14
|
+
// * Type using Zod & Inference
|
|
15
|
+
export const Date = z
|
|
16
|
+
.object({
|
|
17
|
+
id: z
|
|
18
|
+
.string()
|
|
19
|
+
.uuid({ message: 'Must be an UUID' })
|
|
20
|
+
.describe("UUID that identifies the annotation's body."),
|
|
21
|
+
type: z.literal('TextualBody'),
|
|
22
|
+
entityType: DateEntityType,
|
|
23
|
+
value: z
|
|
24
|
+
.string()
|
|
25
|
+
// .datetime() //? We can't use date-time here because we want to capure time-span (start and end date). We should consider a regex
|
|
26
|
+
.describe('The date time.'),
|
|
27
|
+
certainty: Certainty.optional(),
|
|
28
|
+
precision: Precision.optional(),
|
|
29
|
+
})
|
|
30
|
+
.describe('Date');
|
|
31
|
+
// * JSONSchema - entityType
|
|
32
|
+
export const dateEntityTypeSchema = {
|
|
33
|
+
type: 'array',
|
|
34
|
+
minItems: 2,
|
|
35
|
+
maxItems: 2,
|
|
36
|
+
items: [
|
|
37
|
+
{ type: 'string', const: 'xsd:date' },
|
|
38
|
+
{ type: 'string', const: 'crm:E52_Time-Span' },
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
// * JSONSchema
|
|
42
|
+
export const dateSchema = {
|
|
43
|
+
type: 'object',
|
|
44
|
+
description: 'A date entity',
|
|
45
|
+
properties: {
|
|
46
|
+
id: { type: 'string', format: 'uuid' },
|
|
47
|
+
type: { type: 'string', const: 'TextualBody' },
|
|
48
|
+
entityType: dateEntityTypeSchema,
|
|
49
|
+
value: { type: 'string' },
|
|
50
|
+
certainty: { type: 'string', $ref: 'defs.jsonld#/definitions/certainty' },
|
|
51
|
+
precision: { type: 'string', $ref: 'defs.jsonld#/definitions/precision' },
|
|
52
|
+
},
|
|
53
|
+
required: ['id', 'type', 'entityType', 'value'],
|
|
54
|
+
// errorMessage: {
|
|
55
|
+
// properties: {
|
|
56
|
+
// id: 'Must be an UUID',
|
|
57
|
+
// type: 'must be exacty "TextualBody"',
|
|
58
|
+
// },
|
|
59
|
+
// },
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../../src/schema/definitions/body/date.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,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AE,eAAe;IAC5B,UAAU,EAAE;QACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE;QACtC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE;QAC9C,UAAU,EAAE,oBAAoB;QAChC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,oCAAoC,EAAE;QACzE,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,oCAAoC,EAAE;KAC1E;IACD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC;IAC/C,kBAAkB;IAClB,kBAAkB;IAClB,6BAA6B;IAC7B,4CAA4C;IAC5C,OAAO;IACP,KAAK;CACN,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export * from './person';
|
|
4
|
+
export declare const Body: z.ZodObject<{
|
|
5
|
+
id: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
6
|
+
type: z.ZodOptional<z.ZodLiteral<"TextualBody">>;
|
|
7
|
+
entityType: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<"Person">, z.ZodUnion<[z.ZodLiteral<"crm:E21_Person">, z.ZodLiteral<"crm:E89_Propositional_Object">]>], null>, z.ZodUnion<[z.ZodLiteral<"cwrc:place">, z.ZodTuple<[z.ZodLiteral<"cwrc:place">, z.ZodLiteral<"crm:E89_Propositional_Object">], null>]>, z.ZodTuple<[z.ZodLiteral<"foaf:Organization">, z.ZodUnion<[z.ZodLiteral<"crm:E74_Group">, z.ZodLiteral<"crm:E89_Propositional_Object">]>], null>, z.ZodTuple<[z.ZodLiteral<"crm:E89_Propositional_Object">, z.ZodUnion<[z.ZodLiteral<"frbroo:F1">, z.ZodLiteral<"wikidata:Q15306849">]>], null>, z.ZodUnion<[z.ZodLiteral<"crm:E18_Physical_Thing">, z.ZodTuple<[z.ZodLiteral<"crm:E18_Physical_Thing">, z.ZodLiteral<"wikidata:Q15831596">], null>]>, z.ZodUnion<[z.ZodLiteral<"crm:E28_Conceptual_Object">, z.ZodTuple<[z.ZodLiteral<"crm:E28_Conceptual_Object">, z.ZodLiteral<"wikidata:Q15831596">], null>]>, z.ZodTuple<[z.ZodLiteral<"cito:Citation">, z.ZodLiteral<"crm:E73_Information_Object">], null>, z.ZodTuple<[z.ZodLiteral<"xsd:date">, z.ZodLiteral<"crm:E52_Time-Span">], null>, z.ZodLiteral<"crm:E33_Linguistic_Object">, z.ZodTuple<[z.ZodLiteral<"fabio:Correction">, z.ZodLiteral<"crm:E33_Linguistic_Object">], null>, z.ZodTuple<[z.ZodLiteral<"crm:E55_Type">, z.ZodLiteral<"crmdig:D1_Digital_Object">], null>, z.ZodTuple<[z.ZodLiteral<"crm:E55_Type">, z.ZodLiteral<"crm:E33_Linguistic_Object">], null>, z.ZodLiteral<"crmdig:D1_Digital_Object">]>;
|
|
8
|
+
additionalType: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
9
|
+
value: z.ZodOptional<z.ZodString>;
|
|
10
|
+
certainty: z.ZodOptional<z.ZodEnum<["edit:qualityLow", "edit:qualityMedium", "edit:qualityHigh", "edit:qualityUnknown"]>>;
|
|
11
|
+
precision: z.ZodOptional<z.ZodEnum<["edit:qualityLow", "edit:qualityMedium", "edit:qualityHigh", "edit:qualityUnknown"]>>;
|
|
12
|
+
label: z.ZodOptional<z.ZodString>;
|
|
13
|
+
description: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
id: string;
|
|
16
|
+
entityType: ["cito:Citation", "crm:E73_Information_Object"] | "crm:E28_Conceptual_Object" | ["crm:E28_Conceptual_Object", "wikidata:Q15831596"] | ("crm:E28_Conceptual_Object" & ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]) | (["crm:E28_Conceptual_Object", "wikidata:Q15831596"] & "crm:E28_Conceptual_Object") | "crm:E33_Linguistic_Object" | ["fabio:Correction", "crm:E33_Linguistic_Object"] | ["xsd:date", "crm:E52_Time-Span"] | "crmdig:D1_Digital_Object" | ["crm:E55_Type", "crmdig:D1_Digital_Object"] | ["crm:E55_Type", "crm:E33_Linguistic_Object"] | ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] | ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] | "crm:E18_Physical_Thing" | ["crm:E18_Physical_Thing", "wikidata:Q15831596"] | ("crm:E18_Physical_Thing" & ["crm:E18_Physical_Thing", "wikidata:Q15831596"]) | (["crm:E18_Physical_Thing", "wikidata:Q15831596"] & "crm:E18_Physical_Thing") | "cwrc:place" | ["cwrc:place", "crm:E89_Propositional_Object"] | ("cwrc:place" & ["cwrc:place", "crm:E89_Propositional_Object"]) | (["cwrc:place", "crm:E89_Propositional_Object"] & "cwrc:place") | ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] | (["cito:Citation", "crm:E73_Information_Object"] & "crm:E28_Conceptual_Object") | (["cito:Citation", "crm:E73_Information_Object"] & "crm:E33_Linguistic_Object") | (["cito:Citation", "crm:E73_Information_Object"] & "crmdig:D1_Digital_Object") | (["cito:Citation", "crm:E73_Information_Object"] & "crm:E18_Physical_Thing") | (["cito:Citation", "crm:E73_Information_Object"] & "cwrc:place") | ("crm:E28_Conceptual_Object" & ["cito:Citation", "crm:E73_Information_Object"]) | ("crm:E28_Conceptual_Object" & ["fabio:Correction", "crm:E33_Linguistic_Object"]) | ("crm:E28_Conceptual_Object" & ["xsd:date", "crm:E52_Time-Span"]) | ("crm:E28_Conceptual_Object" & ["crm:E55_Type", "crmdig:D1_Digital_Object"]) | ("crm:E28_Conceptual_Object" & ["crm:E55_Type", "crm:E33_Linguistic_Object"]) | ("crm:E28_Conceptual_Object" & ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"]) | ("crm:E28_Conceptual_Object" & ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"]) | ("crm:E28_Conceptual_Object" & ["crm:E18_Physical_Thing", "wikidata:Q15831596"]) | ("crm:E28_Conceptual_Object" & ["cwrc:place", "crm:E89_Propositional_Object"]) | ("crm:E28_Conceptual_Object" & ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"]) | (["crm:E28_Conceptual_Object", "wikidata:Q15831596"] & "crm:E33_Linguistic_Object") | (["crm:E28_Conceptual_Object", "wikidata:Q15831596"] & "crmdig:D1_Digital_Object") | (["crm:E28_Conceptual_Object", "wikidata:Q15831596"] & "crm:E18_Physical_Thing") | (["crm:E28_Conceptual_Object", "wikidata:Q15831596"] & "cwrc:place") | ("crm:E33_Linguistic_Object" & ["cito:Citation", "crm:E73_Information_Object"]) | ("crm:E33_Linguistic_Object" & ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]) | ("crm:E33_Linguistic_Object" & ["fabio:Correction", "crm:E33_Linguistic_Object"]) | ("crm:E33_Linguistic_Object" & ["xsd:date", "crm:E52_Time-Span"]) | ("crm:E33_Linguistic_Object" & ["crm:E55_Type", "crmdig:D1_Digital_Object"]) | ("crm:E33_Linguistic_Object" & ["crm:E55_Type", "crm:E33_Linguistic_Object"]) | ("crm:E33_Linguistic_Object" & ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"]) | ("crm:E33_Linguistic_Object" & ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"]) | ("crm:E33_Linguistic_Object" & ["crm:E18_Physical_Thing", "wikidata:Q15831596"]) | ("crm:E33_Linguistic_Object" & ["cwrc:place", "crm:E89_Propositional_Object"]) | ("crm:E33_Linguistic_Object" & ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"]) | (["fabio:Correction", "crm:E33_Linguistic_Object"] & "crm:E28_Conceptual_Object") | (["fabio:Correction", "crm:E33_Linguistic_Object"] & "crm:E33_Linguistic_Object") | (["fabio:Correction", "crm:E33_Linguistic_Object"] & "crmdig:D1_Digital_Object") | (["fabio:Correction", "crm:E33_Linguistic_Object"] & "crm:E18_Physical_Thing") | (["fabio:Correction", "crm:E33_Linguistic_Object"] & "cwrc:place") | (["xsd:date", "crm:E52_Time-Span"] & "crm:E28_Conceptual_Object") | (["xsd:date", "crm:E52_Time-Span"] & "crm:E33_Linguistic_Object") | (["xsd:date", "crm:E52_Time-Span"] & "crmdig:D1_Digital_Object") | (["xsd:date", "crm:E52_Time-Span"] & "crm:E18_Physical_Thing") | (["xsd:date", "crm:E52_Time-Span"] & "cwrc:place") | ("crmdig:D1_Digital_Object" & ["cito:Citation", "crm:E73_Information_Object"]) | ("crmdig:D1_Digital_Object" & ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]) | ("crmdig:D1_Digital_Object" & ["fabio:Correction", "crm:E33_Linguistic_Object"]) | ("crmdig:D1_Digital_Object" & ["xsd:date", "crm:E52_Time-Span"]) | ("crmdig:D1_Digital_Object" & ["crm:E55_Type", "crmdig:D1_Digital_Object"]) | ("crmdig:D1_Digital_Object" & ["crm:E55_Type", "crm:E33_Linguistic_Object"]) | ("crmdig:D1_Digital_Object" & ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"]) | ("crmdig:D1_Digital_Object" & ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"]) | ("crmdig:D1_Digital_Object" & ["crm:E18_Physical_Thing", "wikidata:Q15831596"]) | ("crmdig:D1_Digital_Object" & ["cwrc:place", "crm:E89_Propositional_Object"]) | ("crmdig:D1_Digital_Object" & ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"]) | (["crm:E55_Type", "crmdig:D1_Digital_Object"] & "crm:E28_Conceptual_Object") | (["crm:E55_Type", "crmdig:D1_Digital_Object"] & "crm:E33_Linguistic_Object") | (["crm:E55_Type", "crmdig:D1_Digital_Object"] & "crmdig:D1_Digital_Object") | (["crm:E55_Type", "crmdig:D1_Digital_Object"] & "crm:E18_Physical_Thing") | (["crm:E55_Type", "crmdig:D1_Digital_Object"] & "cwrc:place") | (["crm:E55_Type", "crm:E33_Linguistic_Object"] & "crm:E28_Conceptual_Object") | (["crm:E55_Type", "crm:E33_Linguistic_Object"] & "crm:E33_Linguistic_Object") | (["crm:E55_Type", "crm:E33_Linguistic_Object"] & "crmdig:D1_Digital_Object") | (["crm:E55_Type", "crm:E33_Linguistic_Object"] & "crm:E18_Physical_Thing") | (["crm:E55_Type", "crm:E33_Linguistic_Object"] & "cwrc:place") | (["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] & "crm:E28_Conceptual_Object") | (["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] & "crm:E33_Linguistic_Object") | (["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] & "crmdig:D1_Digital_Object") | (["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] & "crm:E18_Physical_Thing") | (["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] & "cwrc:place") | (["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] & "crm:E28_Conceptual_Object") | (["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] & "crm:E33_Linguistic_Object") | (["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] & "crmdig:D1_Digital_Object") | (["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] & "crm:E18_Physical_Thing") | (["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] & "cwrc:place") | ("crm:E18_Physical_Thing" & ["cito:Citation", "crm:E73_Information_Object"]) | ("crm:E18_Physical_Thing" & ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]) | ("crm:E18_Physical_Thing" & ["fabio:Correction", "crm:E33_Linguistic_Object"]) | ("crm:E18_Physical_Thing" & ["xsd:date", "crm:E52_Time-Span"]) | ("crm:E18_Physical_Thing" & ["crm:E55_Type", "crmdig:D1_Digital_Object"]) | ("crm:E18_Physical_Thing" & ["crm:E55_Type", "crm:E33_Linguistic_Object"]) | ("crm:E18_Physical_Thing" & ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"]) | ("crm:E18_Physical_Thing" & ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"]) | ("crm:E18_Physical_Thing" & ["cwrc:place", "crm:E89_Propositional_Object"]) | ("crm:E18_Physical_Thing" & ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"]) | (["crm:E18_Physical_Thing", "wikidata:Q15831596"] & "crm:E28_Conceptual_Object") | (["crm:E18_Physical_Thing", "wikidata:Q15831596"] & "crm:E33_Linguistic_Object") | (["crm:E18_Physical_Thing", "wikidata:Q15831596"] & "crmdig:D1_Digital_Object") | (["crm:E18_Physical_Thing", "wikidata:Q15831596"] & "cwrc:place") | ("cwrc:place" & ["cito:Citation", "crm:E73_Information_Object"]) | ("cwrc:place" & ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]) | ("cwrc:place" & ["fabio:Correction", "crm:E33_Linguistic_Object"]) | ("cwrc:place" & ["xsd:date", "crm:E52_Time-Span"]) | ("cwrc:place" & ["crm:E55_Type", "crmdig:D1_Digital_Object"]) | ("cwrc:place" & ["crm:E55_Type", "crm:E33_Linguistic_Object"]) | ("cwrc:place" & ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"]) | ("cwrc:place" & ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"]) | ("cwrc:place" & ["crm:E18_Physical_Thing", "wikidata:Q15831596"]) | ("cwrc:place" & ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"]) | (["cwrc:place", "crm:E89_Propositional_Object"] & "crm:E28_Conceptual_Object") | (["cwrc:place", "crm:E89_Propositional_Object"] & "crm:E33_Linguistic_Object") | (["cwrc:place", "crm:E89_Propositional_Object"] & "crmdig:D1_Digital_Object") | (["cwrc:place", "crm:E89_Propositional_Object"] & "crm:E18_Physical_Thing") | (["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] & "crm:E28_Conceptual_Object") | (["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] & "crm:E33_Linguistic_Object") | (["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] & "crmdig:D1_Digital_Object") | (["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] & "crm:E18_Physical_Thing") | (["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] & "cwrc:place");
|
|
17
|
+
type?: "TextualBody" | undefined;
|
|
18
|
+
additionalType?: string | string[] | undefined;
|
|
19
|
+
value?: string | undefined;
|
|
20
|
+
certainty?: "edit:qualityLow" | "edit:qualityMedium" | "edit:qualityHigh" | "edit:qualityUnknown" | undefined;
|
|
21
|
+
precision?: "edit:qualityLow" | "edit:qualityMedium" | "edit:qualityHigh" | "edit:qualityUnknown" | undefined;
|
|
22
|
+
label?: string | undefined;
|
|
23
|
+
description?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
id: string;
|
|
26
|
+
entityType: ["cito:Citation", "crm:E73_Information_Object"] | "crm:E28_Conceptual_Object" | ["crm:E28_Conceptual_Object", "wikidata:Q15831596"] | ("crm:E28_Conceptual_Object" & ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]) | (["crm:E28_Conceptual_Object", "wikidata:Q15831596"] & "crm:E28_Conceptual_Object") | "crm:E33_Linguistic_Object" | ["fabio:Correction", "crm:E33_Linguistic_Object"] | ["xsd:date", "crm:E52_Time-Span"] | "crmdig:D1_Digital_Object" | ["crm:E55_Type", "crmdig:D1_Digital_Object"] | ["crm:E55_Type", "crm:E33_Linguistic_Object"] | ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] | ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] | "crm:E18_Physical_Thing" | ["crm:E18_Physical_Thing", "wikidata:Q15831596"] | ("crm:E18_Physical_Thing" & ["crm:E18_Physical_Thing", "wikidata:Q15831596"]) | (["crm:E18_Physical_Thing", "wikidata:Q15831596"] & "crm:E18_Physical_Thing") | "cwrc:place" | ["cwrc:place", "crm:E89_Propositional_Object"] | ("cwrc:place" & ["cwrc:place", "crm:E89_Propositional_Object"]) | (["cwrc:place", "crm:E89_Propositional_Object"] & "cwrc:place") | ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] | (["cito:Citation", "crm:E73_Information_Object"] & "crm:E28_Conceptual_Object") | (["cito:Citation", "crm:E73_Information_Object"] & "crm:E33_Linguistic_Object") | (["cito:Citation", "crm:E73_Information_Object"] & "crmdig:D1_Digital_Object") | (["cito:Citation", "crm:E73_Information_Object"] & "crm:E18_Physical_Thing") | (["cito:Citation", "crm:E73_Information_Object"] & "cwrc:place") | ("crm:E28_Conceptual_Object" & ["cito:Citation", "crm:E73_Information_Object"]) | ("crm:E28_Conceptual_Object" & ["fabio:Correction", "crm:E33_Linguistic_Object"]) | ("crm:E28_Conceptual_Object" & ["xsd:date", "crm:E52_Time-Span"]) | ("crm:E28_Conceptual_Object" & ["crm:E55_Type", "crmdig:D1_Digital_Object"]) | ("crm:E28_Conceptual_Object" & ["crm:E55_Type", "crm:E33_Linguistic_Object"]) | ("crm:E28_Conceptual_Object" & ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"]) | ("crm:E28_Conceptual_Object" & ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"]) | ("crm:E28_Conceptual_Object" & ["crm:E18_Physical_Thing", "wikidata:Q15831596"]) | ("crm:E28_Conceptual_Object" & ["cwrc:place", "crm:E89_Propositional_Object"]) | ("crm:E28_Conceptual_Object" & ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"]) | (["crm:E28_Conceptual_Object", "wikidata:Q15831596"] & "crm:E33_Linguistic_Object") | (["crm:E28_Conceptual_Object", "wikidata:Q15831596"] & "crmdig:D1_Digital_Object") | (["crm:E28_Conceptual_Object", "wikidata:Q15831596"] & "crm:E18_Physical_Thing") | (["crm:E28_Conceptual_Object", "wikidata:Q15831596"] & "cwrc:place") | ("crm:E33_Linguistic_Object" & ["cito:Citation", "crm:E73_Information_Object"]) | ("crm:E33_Linguistic_Object" & ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]) | ("crm:E33_Linguistic_Object" & ["fabio:Correction", "crm:E33_Linguistic_Object"]) | ("crm:E33_Linguistic_Object" & ["xsd:date", "crm:E52_Time-Span"]) | ("crm:E33_Linguistic_Object" & ["crm:E55_Type", "crmdig:D1_Digital_Object"]) | ("crm:E33_Linguistic_Object" & ["crm:E55_Type", "crm:E33_Linguistic_Object"]) | ("crm:E33_Linguistic_Object" & ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"]) | ("crm:E33_Linguistic_Object" & ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"]) | ("crm:E33_Linguistic_Object" & ["crm:E18_Physical_Thing", "wikidata:Q15831596"]) | ("crm:E33_Linguistic_Object" & ["cwrc:place", "crm:E89_Propositional_Object"]) | ("crm:E33_Linguistic_Object" & ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"]) | (["fabio:Correction", "crm:E33_Linguistic_Object"] & "crm:E28_Conceptual_Object") | (["fabio:Correction", "crm:E33_Linguistic_Object"] & "crm:E33_Linguistic_Object") | (["fabio:Correction", "crm:E33_Linguistic_Object"] & "crmdig:D1_Digital_Object") | (["fabio:Correction", "crm:E33_Linguistic_Object"] & "crm:E18_Physical_Thing") | (["fabio:Correction", "crm:E33_Linguistic_Object"] & "cwrc:place") | (["xsd:date", "crm:E52_Time-Span"] & "crm:E28_Conceptual_Object") | (["xsd:date", "crm:E52_Time-Span"] & "crm:E33_Linguistic_Object") | (["xsd:date", "crm:E52_Time-Span"] & "crmdig:D1_Digital_Object") | (["xsd:date", "crm:E52_Time-Span"] & "crm:E18_Physical_Thing") | (["xsd:date", "crm:E52_Time-Span"] & "cwrc:place") | ("crmdig:D1_Digital_Object" & ["cito:Citation", "crm:E73_Information_Object"]) | ("crmdig:D1_Digital_Object" & ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]) | ("crmdig:D1_Digital_Object" & ["fabio:Correction", "crm:E33_Linguistic_Object"]) | ("crmdig:D1_Digital_Object" & ["xsd:date", "crm:E52_Time-Span"]) | ("crmdig:D1_Digital_Object" & ["crm:E55_Type", "crmdig:D1_Digital_Object"]) | ("crmdig:D1_Digital_Object" & ["crm:E55_Type", "crm:E33_Linguistic_Object"]) | ("crmdig:D1_Digital_Object" & ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"]) | ("crmdig:D1_Digital_Object" & ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"]) | ("crmdig:D1_Digital_Object" & ["crm:E18_Physical_Thing", "wikidata:Q15831596"]) | ("crmdig:D1_Digital_Object" & ["cwrc:place", "crm:E89_Propositional_Object"]) | ("crmdig:D1_Digital_Object" & ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"]) | (["crm:E55_Type", "crmdig:D1_Digital_Object"] & "crm:E28_Conceptual_Object") | (["crm:E55_Type", "crmdig:D1_Digital_Object"] & "crm:E33_Linguistic_Object") | (["crm:E55_Type", "crmdig:D1_Digital_Object"] & "crmdig:D1_Digital_Object") | (["crm:E55_Type", "crmdig:D1_Digital_Object"] & "crm:E18_Physical_Thing") | (["crm:E55_Type", "crmdig:D1_Digital_Object"] & "cwrc:place") | (["crm:E55_Type", "crm:E33_Linguistic_Object"] & "crm:E28_Conceptual_Object") | (["crm:E55_Type", "crm:E33_Linguistic_Object"] & "crm:E33_Linguistic_Object") | (["crm:E55_Type", "crm:E33_Linguistic_Object"] & "crmdig:D1_Digital_Object") | (["crm:E55_Type", "crm:E33_Linguistic_Object"] & "crm:E18_Physical_Thing") | (["crm:E55_Type", "crm:E33_Linguistic_Object"] & "cwrc:place") | (["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] & "crm:E28_Conceptual_Object") | (["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] & "crm:E33_Linguistic_Object") | (["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] & "crmdig:D1_Digital_Object") | (["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] & "crm:E18_Physical_Thing") | (["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"] & "cwrc:place") | (["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] & "crm:E28_Conceptual_Object") | (["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] & "crm:E33_Linguistic_Object") | (["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] & "crmdig:D1_Digital_Object") | (["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] & "crm:E18_Physical_Thing") | (["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"] & "cwrc:place") | ("crm:E18_Physical_Thing" & ["cito:Citation", "crm:E73_Information_Object"]) | ("crm:E18_Physical_Thing" & ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]) | ("crm:E18_Physical_Thing" & ["fabio:Correction", "crm:E33_Linguistic_Object"]) | ("crm:E18_Physical_Thing" & ["xsd:date", "crm:E52_Time-Span"]) | ("crm:E18_Physical_Thing" & ["crm:E55_Type", "crmdig:D1_Digital_Object"]) | ("crm:E18_Physical_Thing" & ["crm:E55_Type", "crm:E33_Linguistic_Object"]) | ("crm:E18_Physical_Thing" & ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"]) | ("crm:E18_Physical_Thing" & ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"]) | ("crm:E18_Physical_Thing" & ["cwrc:place", "crm:E89_Propositional_Object"]) | ("crm:E18_Physical_Thing" & ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"]) | (["crm:E18_Physical_Thing", "wikidata:Q15831596"] & "crm:E28_Conceptual_Object") | (["crm:E18_Physical_Thing", "wikidata:Q15831596"] & "crm:E33_Linguistic_Object") | (["crm:E18_Physical_Thing", "wikidata:Q15831596"] & "crmdig:D1_Digital_Object") | (["crm:E18_Physical_Thing", "wikidata:Q15831596"] & "cwrc:place") | ("cwrc:place" & ["cito:Citation", "crm:E73_Information_Object"]) | ("cwrc:place" & ["crm:E28_Conceptual_Object", "wikidata:Q15831596"]) | ("cwrc:place" & ["fabio:Correction", "crm:E33_Linguistic_Object"]) | ("cwrc:place" & ["xsd:date", "crm:E52_Time-Span"]) | ("cwrc:place" & ["crm:E55_Type", "crmdig:D1_Digital_Object"]) | ("cwrc:place" & ["crm:E55_Type", "crm:E33_Linguistic_Object"]) | ("cwrc:place" & ["foaf:Organization", "crm:E74_Group" | "crm:E89_Propositional_Object"]) | ("cwrc:place" & ["Person", "crm:E21_Person" | "crm:E89_Propositional_Object"]) | ("cwrc:place" & ["crm:E18_Physical_Thing", "wikidata:Q15831596"]) | ("cwrc:place" & ["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"]) | (["cwrc:place", "crm:E89_Propositional_Object"] & "crm:E28_Conceptual_Object") | (["cwrc:place", "crm:E89_Propositional_Object"] & "crm:E33_Linguistic_Object") | (["cwrc:place", "crm:E89_Propositional_Object"] & "crmdig:D1_Digital_Object") | (["cwrc:place", "crm:E89_Propositional_Object"] & "crm:E18_Physical_Thing") | (["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] & "crm:E28_Conceptual_Object") | (["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] & "crm:E33_Linguistic_Object") | (["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] & "crmdig:D1_Digital_Object") | (["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] & "crm:E18_Physical_Thing") | (["crm:E89_Propositional_Object", "frbroo:F1" | "wikidata:Q15306849"] & "cwrc:place");
|
|
27
|
+
type?: "TextualBody" | undefined;
|
|
28
|
+
additionalType?: string | string[] | undefined;
|
|
29
|
+
value?: string | undefined;
|
|
30
|
+
certainty?: "edit:qualityLow" | "edit:qualityMedium" | "edit:qualityHigh" | "edit:qualityUnknown" | undefined;
|
|
31
|
+
precision?: "edit:qualityLow" | "edit:qualityMedium" | "edit:qualityHigh" | "edit:qualityUnknown" | undefined;
|
|
32
|
+
label?: string | undefined;
|
|
33
|
+
description?: string | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
export type Body = z.infer<typeof Body>;
|
|
36
|
+
export declare const bodySchema: JSONSchemaType<Required<Body>>;
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schema/definitions/body/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiCxB,cAAc,UAAU,CAAC;AAkBzB,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCiB,CAAC;AAEnC,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAIxC,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAqJrD,CAAC"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CitationEntityType, citationEntityTypeSchema } from './citation';
|
|
3
|
+
import { Certainty, Description, Label, Precision, certaintySchema, descriptionSchema, labelSchema, precisionSchema, } from './common';
|
|
4
|
+
import { ConceptualObjectEntityType, conceptualObjectEntityTypeSchema } from './conceptualObject';
|
|
5
|
+
import { CorrectionEntityType, correctionEntityTypeSchema } from './correction';
|
|
6
|
+
import { DateEntityType, dateEntityTypeSchema } from './date';
|
|
7
|
+
import { KeywordEntityType, KeywordFolksnomyEntityType, keywordEntityTypeSchema, keywordFolksnomyEntityTypeSchema, } from './keyword';
|
|
8
|
+
import { LinkEntityType, linkEntityTypeSchema } from './link';
|
|
9
|
+
import { NoteEntityType, noteEntityTypeSchema } from './note';
|
|
10
|
+
import { OrganizationEntityType, organizationEntityTypeSchema } from './organization';
|
|
11
|
+
import { PersonEntityType, personEntityTypeSchema } from './person';
|
|
12
|
+
import { PhysicalThingEntityType, physicalThingEntityTypeSchema } from './physicalThing';
|
|
13
|
+
import { PlaceEntityType, placeEntityTypeSchema } from './place';
|
|
14
|
+
import { WorkEntityType, workEntityTypeSchema } from './work';
|
|
15
|
+
//* date pattern: yyyy-mm-dd:hh-mm-ssz/yyyy-mm-dd:hh-mm-ssz
|
|
16
|
+
const 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)?)$';
|
|
17
|
+
export * from './person';
|
|
18
|
+
// * Pure Typescript Type - Just for reference
|
|
19
|
+
// export interface Body {
|
|
20
|
+
// id: string;
|
|
21
|
+
// type?: 'TextualBody';
|
|
22
|
+
// entityType: string | string[];
|
|
23
|
+
// additionalType?: string | string[];
|
|
24
|
+
// value?: string;
|
|
25
|
+
// certainty?: Certainty;
|
|
26
|
+
// precision?: Precision;
|
|
27
|
+
// label?: string;
|
|
28
|
+
// description?: string;
|
|
29
|
+
// }
|
|
30
|
+
// * Type using Zod & Inference
|
|
31
|
+
export const Body = z
|
|
32
|
+
.object({
|
|
33
|
+
id: z.union([
|
|
34
|
+
z
|
|
35
|
+
.string()
|
|
36
|
+
.url({ message: 'Must be an URI' })
|
|
37
|
+
.describe('The IRI that identifies the Body resource.'),
|
|
38
|
+
z
|
|
39
|
+
.string()
|
|
40
|
+
.uuid({ message: 'Must be an UUID' })
|
|
41
|
+
.describe("UUID that identifies the annotation's body."),
|
|
42
|
+
]),
|
|
43
|
+
type: z.literal('TextualBody').optional(),
|
|
44
|
+
entityType: z.union([
|
|
45
|
+
PersonEntityType,
|
|
46
|
+
PlaceEntityType,
|
|
47
|
+
OrganizationEntityType,
|
|
48
|
+
WorkEntityType,
|
|
49
|
+
PhysicalThingEntityType,
|
|
50
|
+
ConceptualObjectEntityType,
|
|
51
|
+
CitationEntityType,
|
|
52
|
+
DateEntityType,
|
|
53
|
+
NoteEntityType,
|
|
54
|
+
CorrectionEntityType,
|
|
55
|
+
KeywordEntityType,
|
|
56
|
+
KeywordFolksnomyEntityType,
|
|
57
|
+
LinkEntityType,
|
|
58
|
+
]),
|
|
59
|
+
additionalType: z
|
|
60
|
+
.union([z.string(), z.string().array()])
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('Extra types that refines the body'),
|
|
63
|
+
value: z.string().describe('The value of the body').optional(),
|
|
64
|
+
certainty: Certainty.optional(),
|
|
65
|
+
precision: Precision.optional(),
|
|
66
|
+
label: Label.optional(),
|
|
67
|
+
description: Description.optional(),
|
|
68
|
+
})
|
|
69
|
+
.describe('Web Annotation Body');
|
|
70
|
+
// * JSONSchema
|
|
71
|
+
export const bodySchema = {
|
|
72
|
+
type: 'object',
|
|
73
|
+
description: 'Web Annotation Body',
|
|
74
|
+
properties: {
|
|
75
|
+
id: {
|
|
76
|
+
oneOf: [
|
|
77
|
+
{ type: 'string', format: 'uri', description: 'The IRI that identifies the Body resource' },
|
|
78
|
+
{ type: 'string', format: 'uuid' },
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
type: { type: 'string', const: 'TextualBody' },
|
|
82
|
+
entityType: {
|
|
83
|
+
oneOf: [
|
|
84
|
+
personEntityTypeSchema,
|
|
85
|
+
placeEntityTypeSchema,
|
|
86
|
+
organizationEntityTypeSchema,
|
|
87
|
+
workEntityTypeSchema,
|
|
88
|
+
physicalThingEntityTypeSchema,
|
|
89
|
+
conceptualObjectEntityTypeSchema,
|
|
90
|
+
citationEntityTypeSchema,
|
|
91
|
+
dateEntityTypeSchema,
|
|
92
|
+
noteEntityTypeSchema,
|
|
93
|
+
correctionEntityTypeSchema,
|
|
94
|
+
keywordEntityTypeSchema,
|
|
95
|
+
keywordFolksnomyEntityTypeSchema,
|
|
96
|
+
linkEntityTypeSchema,
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
additionalType: {
|
|
100
|
+
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
101
|
+
},
|
|
102
|
+
value: { type: 'string' },
|
|
103
|
+
certainty: certaintySchema,
|
|
104
|
+
precision: precisionSchema,
|
|
105
|
+
label: labelSchema,
|
|
106
|
+
description: descriptionSchema,
|
|
107
|
+
},
|
|
108
|
+
required: ['id', 'entityType'],
|
|
109
|
+
// * Conditional restrictions
|
|
110
|
+
anyOf: [
|
|
111
|
+
//* IF type is TextualBody THEN id = uuid
|
|
112
|
+
//* && IF entityType is date THEN value = date range pattern ELSE value = string
|
|
113
|
+
// {
|
|
114
|
+
// if: {
|
|
115
|
+
// type: 'object',
|
|
116
|
+
// properties: { type: { const: 'TextualBody' } },
|
|
117
|
+
// },
|
|
118
|
+
// then: {
|
|
119
|
+
// type: 'object',
|
|
120
|
+
// required: ['value'],
|
|
121
|
+
// properties: { id: { type: 'string', format: 'uuid' } },
|
|
122
|
+
// if: {
|
|
123
|
+
// type: 'object',
|
|
124
|
+
// properties: {
|
|
125
|
+
// entityType: {
|
|
126
|
+
// type: 'array',
|
|
127
|
+
// minItems: 2,
|
|
128
|
+
// maxItems: 2,
|
|
129
|
+
// items: [
|
|
130
|
+
// { type: 'string', const: 'xsd:date' },
|
|
131
|
+
// { type: 'string', const: 'crm:E52_Time-Span' },
|
|
132
|
+
// ],
|
|
133
|
+
// },
|
|
134
|
+
// },
|
|
135
|
+
// },
|
|
136
|
+
// then: {
|
|
137
|
+
// type: 'object',
|
|
138
|
+
// properties: { value: { type: 'string', pattern: DATE_PATTERN } },
|
|
139
|
+
// },
|
|
140
|
+
// else: {
|
|
141
|
+
// type: 'object',
|
|
142
|
+
// properties: { value: { type: 'string' } },
|
|
143
|
+
// },
|
|
144
|
+
// },
|
|
145
|
+
// },
|
|
146
|
+
//* IF entityType is date OR correction OR keyword THEN id = uuid AND type = TextualBody
|
|
147
|
+
//* && IF entityType is date THEN value = date range pattern ELSE value = string
|
|
148
|
+
{
|
|
149
|
+
if: {
|
|
150
|
+
type: 'object',
|
|
151
|
+
properties: {
|
|
152
|
+
entityType: {
|
|
153
|
+
anyOf: [
|
|
154
|
+
{ const: 'crm:E33_Linguistic_Object' },
|
|
155
|
+
{
|
|
156
|
+
type: 'array',
|
|
157
|
+
minItems: 2,
|
|
158
|
+
maxItems: 2,
|
|
159
|
+
items: [{ const: 'xsd:date' }, { const: 'crm:E52_Time-Span' }],
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: 'array',
|
|
163
|
+
minItems: 2,
|
|
164
|
+
maxItems: 2,
|
|
165
|
+
items: [{ const: 'fabio:Correction' }, { const: 'crm:E33_Linguistic_Object' }],
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
type: 'array',
|
|
169
|
+
minItems: 2,
|
|
170
|
+
maxItems: 2,
|
|
171
|
+
items: [{ const: 'crm:E55_Type' }, { const: 'crm:E33_Linguistic_Object' }],
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
then: {
|
|
178
|
+
type: 'object',
|
|
179
|
+
required: ['type', 'value'],
|
|
180
|
+
properties: {
|
|
181
|
+
id: { type: 'string', format: 'uuid' },
|
|
182
|
+
type: { type: 'string', const: 'TextualBody' },
|
|
183
|
+
},
|
|
184
|
+
if: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
entityType: {
|
|
188
|
+
type: 'array',
|
|
189
|
+
minItems: 2,
|
|
190
|
+
maxItems: 2,
|
|
191
|
+
items: [{ const: 'xsd:date' }, { const: 'crm:E52_Time-Span' }],
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
then: {
|
|
196
|
+
type: 'object',
|
|
197
|
+
properties: {
|
|
198
|
+
value: {
|
|
199
|
+
type: 'string',
|
|
200
|
+
pattern: DATE_PATTERN,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
else: {
|
|
205
|
+
type: 'object',
|
|
206
|
+
properties: { value: { type: 'string' } },
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
else: {
|
|
210
|
+
type: 'object',
|
|
211
|
+
properties: { id: { type: 'string', format: 'uri' } },
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
// ? TODO: Add more restrictions
|
|
215
|
+
// ? - Not accept certainty and precision for some entityTypes
|
|
216
|
+
// ? - Not accept value for some entityTypes
|
|
217
|
+
],
|
|
218
|
+
additionalProperties: false,
|
|
219
|
+
};
|
|
220
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/schema/definitions/body/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,SAAS,EACT,WAAW,EACX,KAAK,EACL,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,eAAe,GAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB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