11import {
2+ emptyAgent ,
23 emptyAnnotation ,
34 emptyAnnotationCollection ,
45 emptyCanvas ,
6+ emptyCollection ,
57 emptyContentResource ,
68 emptyManifest ,
79 emptyRange ,
810 emptySpecificResource ,
11+ emptyTimeline ,
912} from "../../src/presentation-4/empty-types" ;
1013import type {
14+ AgentNormalized ,
1115 AnnotationCollectionNormalized ,
1216 AnnotationNormalized ,
1317 CanvasNormalized ,
18+ CollectionNormalized ,
1419 ContentResourceNormalized ,
1520 ManifestNormalized ,
1621 RangeNormalized ,
1722 SpecificResourceNormalized ,
23+ TimelineNormalized ,
1824} from "../../src/presentation-4-normalized/types" ;
1925
2026const manifestWithContext = {
@@ -24,13 +30,50 @@ const manifestWithContext = {
2430
2531void manifestWithContext ;
2632
33+ const manifestWithExtendedLinking = {
34+ ...emptyManifest ,
35+ behavior : [ "paged" ] ,
36+ rights : "https://creativecommons.org/licenses/by/4.0/" ,
37+ navDate : "2025-01-01T00:00:00Z" ,
38+ navPlace : { lat : 51.5 , lng : - 0.12 } ,
39+ requiredStatement : {
40+ label : { en : [ "Attribution" ] } ,
41+ value : { en : [ "Provided by Example" ] } ,
42+ } ,
43+ profile : [ "example-profile" , { level : 2 } ] ,
44+ placeholderContainer : { id : "https://example.org/canvas/placeholder" , type : "Canvas" } ,
45+ accompanyingContainer : { id : "https://example.org/canvas/accompanying" , type : "Canvas" } ,
46+ "iiif-parser:hasPart" : [
47+ {
48+ id : "https://example.org/manifest/part/1" ,
49+ type : "Manifest" ,
50+ "@explicit" : true ,
51+ "iiif-parser:partOf" : "https://example.org/manifest/1" ,
52+ } ,
53+ ] ,
54+ } satisfies ManifestNormalized ;
55+
56+ void manifestWithExtendedLinking ;
57+
2758const canvasWithDuration = {
2859 ...emptyCanvas ,
2960 duration : 12.5 ,
61+ viewingDirection : "left-to-right" ,
62+ backgroundColor : "#f6f6f6" ,
63+ temporalScale : 1 ,
64+ spatialScale : 2 ,
3065} satisfies CanvasNormalized ;
3166
3267void canvasWithDuration ;
3368
69+ const canvasWithInvalidItems = {
70+ ...emptyCanvas ,
71+ // @ts -expect-error canvas items must be an array of references
72+ items : { id : "https://example.org/page/1" , type : "AnnotationPage" } ,
73+ } satisfies CanvasNormalized ;
74+
75+ void canvasWithInvalidItems ;
76+
3477const contentResourceWithTechnicalFields = {
3578 ...emptyContentResource ,
3679 type : "Image" ,
@@ -39,10 +82,28 @@ const contentResourceWithTechnicalFields = {
3982 height : 1200 ,
4083 width : 800 ,
4184 duration : 9 ,
85+ language : [ "en" , "fr" ] ,
86+ behavior : [ "no-nav" ] ,
87+ service : [ { id : "https://example.org/service/image" , type : "ImageService3" , profile : "level1" } ] ,
88+ services : [ { id : "https://example.org/service/auth" , type : "AuthCookieService1" } ] ,
89+ lookAt : { x : 10 , y : 20 , z : 30 } ,
90+ provides : [ "subtitles" , "translation" ] ,
91+ selector : [ { type : "PointSelector" , x : 10 , y : 20 , z : 3 } ] ,
92+ transform : [ { type : "RotateTransform" , z : 90 } ] ,
93+ action : [ { type : "Highlight" , target : "region-1" } ] ,
4294} satisfies ContentResourceNormalized ;
4395
4496void contentResourceWithTechnicalFields ;
4597
98+ const contentResourceWithInvalidLanguage = {
99+ ...emptyContentResource ,
100+ type : "Text" ,
101+ // @ts -expect-error normalized language must be an array of strings
102+ language : "en" ,
103+ } satisfies ContentResourceNormalized ;
104+
105+ void contentResourceWithInvalidLanguage ;
106+
46107const specificResourceWithSelector = {
47108 ...emptySpecificResource ,
48109 selector : [
@@ -51,6 +112,8 @@ const specificResourceWithSelector = {
51112 value : "xywh=10,20,30,40" ,
52113 } ,
53114 ] ,
115+ styleClass : "detail-region" ,
116+ action : [ { type : "Flash" , duration : 1200 } ] ,
54117} satisfies SpecificResourceNormalized ;
55118
56119void specificResourceWithSelector ;
@@ -63,6 +126,14 @@ const specificResourceWithoutId = {
63126
64127void specificResourceWithoutId ;
65128
129+ const specificResourceWithInvalidSource = {
130+ ...emptySpecificResource ,
131+ // @ts -expect-error source must be a normalized reference object
132+ source : "https://example.org/canvas/1" ,
133+ } satisfies SpecificResourceNormalized ;
134+
135+ void specificResourceWithInvalidSource ;
136+
66137const annotationWithEmptyBody = {
67138 ...emptyAnnotation ,
68139 target : { id : "https://example.org/canvas/1" , type : "Canvas" } ,
@@ -71,13 +142,50 @@ const annotationWithEmptyBody = {
71142
72143void annotationWithEmptyBody ;
73144
145+ const annotationWithSpecificResourceBody = {
146+ ...emptyAnnotation ,
147+ motivation : [ "painting" , "commenting" ] ,
148+ body : {
149+ id : "https://example.org/annotation/1/body/1" ,
150+ type : "SpecificResource" ,
151+ source : { id : "https://example.org/image/1" , type : "Image" } ,
152+ selector : [ { type : "FragmentSelector" , value : "xywh=0,0,100,100" } ] ,
153+ transform : [ ] ,
154+ action : [ ] ,
155+ } ,
156+ target : {
157+ id : "https://example.org/canvas/2#t=10,20" ,
158+ type : "Canvas" ,
159+ } ,
160+ } satisfies AnnotationNormalized ;
161+
162+ void annotationWithSpecificResourceBody ;
163+
164+ const annotationWithInvalidBody = {
165+ ...emptyAnnotation ,
166+ target : { id : "https://example.org/canvas/1" , type : "Canvas" } ,
167+ // @ts -expect-error body must be a normalized reference or null
168+ body : "https://example.org/image/1" ,
169+ } satisfies AnnotationNormalized ;
170+
171+ void annotationWithInvalidBody ;
172+
74173const rangeWithSupplementary = {
75174 ...emptyRange ,
175+ start : { id : "https://example.org/canvas/5" , type : "Canvas" } ,
76176 supplementary : [ { id : "https://example.org/annotation-collection/1" , type : "AnnotationCollection" } ] ,
77177} satisfies RangeNormalized ;
78178
79179void rangeWithSupplementary ;
80180
181+ const rangeWithInvalidStart = {
182+ ...emptyRange ,
183+ // @ts -expect-error start must be a normalized reference object
184+ start : "https://example.org/canvas/6" ,
185+ } satisfies RangeNormalized ;
186+
187+ void rangeWithInvalidStart ;
188+
81189const annotationCollectionWithPagingFields = {
82190 ...emptyAnnotationCollection ,
83191 first : { id : "https://example.org/annotation-collection/1/page/1" , type : "AnnotationPage" } ,
@@ -86,3 +194,37 @@ const annotationCollectionWithPagingFields = {
86194} satisfies AnnotationCollectionNormalized ;
87195
88196void annotationCollectionWithPagingFields ;
197+
198+ const annotationCollectionWithNullPaging = {
199+ ...emptyAnnotationCollection ,
200+ first : null ,
201+ last : null ,
202+ total : 0 ,
203+ } satisfies AnnotationCollectionNormalized ;
204+
205+ void annotationCollectionWithNullPaging ;
206+
207+ const collectionWithFraming = {
208+ ...emptyCollection ,
209+ items : [ { id : "https://example.org/manifest/1" , type : "Manifest" } ] ,
210+ "@context" : [ "http://iiif.io/api/presentation/4/context.json" , { custom : true } ] ,
211+ } satisfies CollectionNormalized ;
212+
213+ void collectionWithFraming ;
214+
215+ const timelineWithTechnicalFields = {
216+ ...emptyTimeline ,
217+ duration : 33.2 ,
218+ timeMode : "trimmed" ,
219+ items : [ { id : "https://example.org/canvas/1" , type : "Canvas" } ] ,
220+ } satisfies TimelineNormalized ;
221+
222+ void timelineWithTechnicalFields ;
223+
224+ const agentWithLogoAndHomepage = {
225+ ...emptyAgent ,
226+ logo : [ { id : "https://example.org/logo.png" , type : "Image" } ] ,
227+ homepage : [ { id : "https://example.org" , type : "Text" } ] ,
228+ } satisfies AgentNormalized ;
229+
230+ void agentWithLogoAndHomepage ;
0 commit comments