0 | module Web.Internal.ServiceworkerTypes
  1 |
  2 | import JS
  3 |
  4 | %default total
  5 |
  6 |
  7 | --------------------------------------------------------------------------------
  8 | --          Enums
  9 | --------------------------------------------------------------------------------
 10 |
 11 | namespace ServiceWorkerState
 12 |
 13 |   public export
 14 |   data ServiceWorkerState =
 15 |       Parsed
 16 |     | Installing
 17 |     | Installed
 18 |     | Activating
 19 |     | Activated
 20 |     | Redundant
 21 |
 22 |   public export
 23 |   Show ServiceWorkerState where
 24 |     show Parsed = "parsed"
 25 |     show Installing = "installing"
 26 |     show Installed = "installed"
 27 |     show Activating = "activating"
 28 |     show Activated = "activated"
 29 |     show Redundant = "redundant"
 30 |
 31 |   public export
 32 |   Eq ServiceWorkerState where
 33 |     (==) = (==) `on` show
 34 |
 35 |   public export
 36 |   Ord ServiceWorkerState where
 37 |     compare = compare `on` show
 38 |
 39 |   public export
 40 |   read : String -> Maybe ServiceWorkerState
 41 |   read "parsed" = Just Parsed
 42 |   read "installing" = Just Installing
 43 |   read "installed" = Just Installed
 44 |   read "activating" = Just Activating
 45 |   read "activated" = Just Activated
 46 |   read "redundant" = Just Redundant
 47 |   read _ = Nothing
 48 |
 49 |   export
 50 |   ToFFI ServiceWorkerState String where
 51 |     toFFI = show
 52 |
 53 |   export
 54 |   FromFFI ServiceWorkerState String where
 55 |     fromFFI = read
 56 |
 57 |
 58 | namespace ServiceWorkerUpdateViaCache
 59 |
 60 |   public export
 61 |   data ServiceWorkerUpdateViaCache = Imports | All | None
 62 |
 63 |   public export
 64 |   Show ServiceWorkerUpdateViaCache where
 65 |     show Imports = "imports"
 66 |     show All = "all"
 67 |     show None = "none"
 68 |
 69 |   public export
 70 |   Eq ServiceWorkerUpdateViaCache where
 71 |     (==) = (==) `on` show
 72 |
 73 |   public export
 74 |   Ord ServiceWorkerUpdateViaCache where
 75 |     compare = compare `on` show
 76 |
 77 |   public export
 78 |   read : String -> Maybe ServiceWorkerUpdateViaCache
 79 |   read "imports" = Just Imports
 80 |   read "all" = Just All
 81 |   read "none" = Just None
 82 |   read _ = Nothing
 83 |
 84 |   export
 85 |   ToFFI ServiceWorkerUpdateViaCache String where
 86 |     toFFI = show
 87 |
 88 |   export
 89 |   FromFFI ServiceWorkerUpdateViaCache String where
 90 |     fromFFI = read
 91 |
 92 |
 93 | namespace FrameType
 94 |
 95 |   public export
 96 |   data FrameType = Auxiliary | TopLevel | Nested | None
 97 |
 98 |   public export
 99 |   Show FrameType where
100 |     show Auxiliary = "auxiliary"
101 |     show TopLevel = "top-level"
102 |     show Nested = "nested"
103 |     show None = "none"
104 |
105 |   public export
106 |   Eq FrameType where
107 |     (==) = (==) `on` show
108 |
109 |   public export
110 |   Ord FrameType where
111 |     compare = compare `on` show
112 |
113 |   public export
114 |   read : String -> Maybe FrameType
115 |   read "auxiliary" = Just Auxiliary
116 |   read "top-level" = Just TopLevel
117 |   read "nested" = Just Nested
118 |   read "none" = Just None
119 |   read _ = Nothing
120 |
121 |   export
122 |   ToFFI FrameType String where
123 |     toFFI = show
124 |
125 |   export
126 |   FromFFI FrameType String where
127 |     fromFFI = read
128 |
129 |
130 | namespace ClientType
131 |
132 |   public export
133 |   data ClientType = Window | Worker | Sharedworker | All
134 |
135 |   public export
136 |   Show ClientType where
137 |     show Window = "window"
138 |     show Worker = "worker"
139 |     show Sharedworker = "sharedworker"
140 |     show All = "all"
141 |
142 |   public export
143 |   Eq ClientType where
144 |     (==) = (==) `on` show
145 |
146 |   public export
147 |   Ord ClientType where
148 |     compare = compare `on` show
149 |
150 |   public export
151 |   read : String -> Maybe ClientType
152 |   read "window" = Just Window
153 |   read "worker" = Just Worker
154 |   read "sharedworker" = Just Sharedworker
155 |   read "all" = Just All
156 |   read _ = Nothing
157 |
158 |   export
159 |   ToFFI ClientType String where
160 |     toFFI = show
161 |
162 |   export
163 |   FromFFI ClientType String where
164 |     fromFFI = read
165 |
166 |
167 |
168 | --------------------------------------------------------------------------------
169 | --          Interfaces
170 | --------------------------------------------------------------------------------
171 |
172 | export data Cache : Type where [external]
173 |
174 | export
175 | ToFFI Cache Cache where toFFI = id
176 |
177 | export
178 | FromFFI Cache Cache where fromFFI = Just
179 |
180 | export
181 | SafeCast Cache where
182 |   safeCast = unsafeCastOnPrototypeName "Cache"
183 |
184 | export data CacheStorage : Type where [external]
185 |
186 | export
187 | ToFFI CacheStorage CacheStorage where toFFI = id
188 |
189 | export
190 | FromFFI CacheStorage CacheStorage where fromFFI = Just
191 |
192 | export
193 | SafeCast CacheStorage where
194 |   safeCast = unsafeCastOnPrototypeName "CacheStorage"
195 |
196 | export data Client : Type where [external]
197 |
198 | export
199 | ToFFI Client Client where toFFI = id
200 |
201 | export
202 | FromFFI Client Client where fromFFI = Just
203 |
204 | export
205 | SafeCast Client where
206 |   safeCast = unsafeCastOnPrototypeName "Client"
207 |
208 | export data Clients : Type where [external]
209 |
210 | export
211 | ToFFI Clients Clients where toFFI = id
212 |
213 | export
214 | FromFFI Clients Clients where fromFFI = Just
215 |
216 | export
217 | SafeCast Clients where
218 |   safeCast = unsafeCastOnPrototypeName "Clients"
219 |
220 | export data ExtendableEvent : Type where [external]
221 |
222 | export
223 | ToFFI ExtendableEvent ExtendableEvent where toFFI = id
224 |
225 | export
226 | FromFFI ExtendableEvent ExtendableEvent where fromFFI = Just
227 |
228 | export
229 | SafeCast ExtendableEvent where
230 |   safeCast = unsafeCastOnPrototypeName "ExtendableEvent"
231 |
232 | export data ExtendableMessageEvent : Type where [external]
233 |
234 | export
235 | ToFFI ExtendableMessageEvent ExtendableMessageEvent where toFFI = id
236 |
237 | export
238 | FromFFI ExtendableMessageEvent ExtendableMessageEvent where fromFFI = Just
239 |
240 | export
241 | SafeCast ExtendableMessageEvent where
242 |   safeCast = unsafeCastOnPrototypeName "ExtendableMessageEvent"
243 |
244 | export data FetchEvent : Type where [external]
245 |
246 | export
247 | ToFFI FetchEvent FetchEvent where toFFI = id
248 |
249 | export
250 | FromFFI FetchEvent FetchEvent where fromFFI = Just
251 |
252 | export
253 | SafeCast FetchEvent where
254 |   safeCast = unsafeCastOnPrototypeName "FetchEvent"
255 |
256 | export data NavigationPreloadManager : Type where [external]
257 |
258 | export
259 | ToFFI NavigationPreloadManager NavigationPreloadManager where toFFI = id
260 |
261 | export
262 | FromFFI NavigationPreloadManager NavigationPreloadManager where fromFFI = Just
263 |
264 | export
265 | SafeCast NavigationPreloadManager where
266 |   safeCast = unsafeCastOnPrototypeName "NavigationPreloadManager"
267 |
268 | export data ServiceWorker : Type where [external]
269 |
270 | export
271 | ToFFI ServiceWorker ServiceWorker where toFFI = id
272 |
273 | export
274 | FromFFI ServiceWorker ServiceWorker where fromFFI = Just
275 |
276 | export
277 | SafeCast ServiceWorker where
278 |   safeCast = unsafeCastOnPrototypeName "ServiceWorker"
279 |
280 | export data ServiceWorkerContainer : Type where [external]
281 |
282 | export
283 | ToFFI ServiceWorkerContainer ServiceWorkerContainer where toFFI = id
284 |
285 | export
286 | FromFFI ServiceWorkerContainer ServiceWorkerContainer where fromFFI = Just
287 |
288 | export
289 | SafeCast ServiceWorkerContainer where
290 |   safeCast = unsafeCastOnPrototypeName "ServiceWorkerContainer"
291 |
292 | export data ServiceWorkerGlobalScope : Type where [external]
293 |
294 | export
295 | ToFFI ServiceWorkerGlobalScope ServiceWorkerGlobalScope where toFFI = id
296 |
297 | export
298 | FromFFI ServiceWorkerGlobalScope ServiceWorkerGlobalScope where fromFFI = Just
299 |
300 | export
301 | SafeCast ServiceWorkerGlobalScope where
302 |   safeCast = unsafeCastOnPrototypeName "ServiceWorkerGlobalScope"
303 |
304 | export data ServiceWorkerRegistration : Type where [external]
305 |
306 | export
307 | ToFFI ServiceWorkerRegistration ServiceWorkerRegistration where toFFI = id
308 |
309 | export
310 | FromFFI ServiceWorkerRegistration ServiceWorkerRegistration where fromFFI = Just
311 |
312 | export
313 | SafeCast ServiceWorkerRegistration where
314 |   safeCast = unsafeCastOnPrototypeName "ServiceWorkerRegistration"
315 |
316 | export data WindowClient : Type where [external]
317 |
318 | export
319 | ToFFI WindowClient WindowClient where toFFI = id
320 |
321 | export
322 | FromFFI WindowClient WindowClient where fromFFI = Just
323 |
324 | export
325 | SafeCast WindowClient where
326 |   safeCast = unsafeCastOnPrototypeName "WindowClient"
327 |
328 |
329 | --------------------------------------------------------------------------------
330 | --          Dictionaries
331 | --------------------------------------------------------------------------------
332 |
333 | export data CacheQueryOptions : Type where [external]
334 |
335 | export
336 | ToFFI CacheQueryOptions CacheQueryOptions where toFFI = id
337 |
338 | export
339 | FromFFI CacheQueryOptions CacheQueryOptions where fromFFI = Just
340 |
341 | export data ClientQueryOptions : Type where [external]
342 |
343 | export
344 | ToFFI ClientQueryOptions ClientQueryOptions where toFFI = id
345 |
346 | export
347 | FromFFI ClientQueryOptions ClientQueryOptions where fromFFI = Just
348 |
349 | export data ExtendableEventInit : Type where [external]
350 |
351 | export
352 | ToFFI ExtendableEventInit ExtendableEventInit where toFFI = id
353 |
354 | export
355 | FromFFI ExtendableEventInit ExtendableEventInit where fromFFI = Just
356 |
357 | export data ExtendableMessageEventInit : Type where [external]
358 |
359 | export
360 | ToFFI ExtendableMessageEventInit ExtendableMessageEventInit where toFFI = id
361 |
362 | export
363 | FromFFI ExtendableMessageEventInit ExtendableMessageEventInit where fromFFI = Just
364 |
365 | export data FetchEventInit : Type where [external]
366 |
367 | export
368 | ToFFI FetchEventInit FetchEventInit where toFFI = id
369 |
370 | export
371 | FromFFI FetchEventInit FetchEventInit where fromFFI = Just
372 |
373 | export data MultiCacheQueryOptions : Type where [external]
374 |
375 | export
376 | ToFFI MultiCacheQueryOptions MultiCacheQueryOptions where toFFI = id
377 |
378 | export
379 | FromFFI MultiCacheQueryOptions MultiCacheQueryOptions where fromFFI = Just
380 |
381 | export data NavigationPreloadState : Type where [external]
382 |
383 | export
384 | ToFFI NavigationPreloadState NavigationPreloadState where toFFI = id
385 |
386 | export
387 | FromFFI NavigationPreloadState NavigationPreloadState where fromFFI = Just
388 |
389 | export data RegistrationOptions : Type where [external]
390 |
391 | export
392 | ToFFI RegistrationOptions RegistrationOptions where toFFI = id
393 |
394 | export
395 | FromFFI RegistrationOptions RegistrationOptions where fromFFI = Just
396 |