0 | module Web.Internal.IndexedDBTypes
  1 |
  2 | import JS
  3 |
  4 | %default total
  5 |
  6 |
  7 | --------------------------------------------------------------------------------
  8 | --          Enums
  9 | --------------------------------------------------------------------------------
 10 |
 11 | namespace IDBRequestReadyState
 12 |
 13 |   public export
 14 |   data IDBRequestReadyState = Pending | Done
 15 |
 16 |   public export
 17 |   Show IDBRequestReadyState where
 18 |     show Pending = "pending"
 19 |     show Done = "done"
 20 |
 21 |   public export
 22 |   Eq IDBRequestReadyState where
 23 |     (==) = (==) `on` show
 24 |
 25 |   public export
 26 |   Ord IDBRequestReadyState where
 27 |     compare = compare `on` show
 28 |
 29 |   public export
 30 |   read : String -> Maybe IDBRequestReadyState
 31 |   read "pending" = Just Pending
 32 |   read "done" = Just Done
 33 |   read _ = Nothing
 34 |
 35 |   export
 36 |   ToFFI IDBRequestReadyState String where
 37 |     toFFI = show
 38 |
 39 |   export
 40 |   FromFFI IDBRequestReadyState String where
 41 |     fromFFI = read
 42 |
 43 |
 44 | namespace IDBTransactionDurability
 45 |
 46 |   public export
 47 |   data IDBTransactionDurability = Default | Strict | Relaxed
 48 |
 49 |   public export
 50 |   Show IDBTransactionDurability where
 51 |     show Default = "default"
 52 |     show Strict = "strict"
 53 |     show Relaxed = "relaxed"
 54 |
 55 |   public export
 56 |   Eq IDBTransactionDurability where
 57 |     (==) = (==) `on` show
 58 |
 59 |   public export
 60 |   Ord IDBTransactionDurability where
 61 |     compare = compare `on` show
 62 |
 63 |   public export
 64 |   read : String -> Maybe IDBTransactionDurability
 65 |   read "default" = Just Default
 66 |   read "strict" = Just Strict
 67 |   read "relaxed" = Just Relaxed
 68 |   read _ = Nothing
 69 |
 70 |   export
 71 |   ToFFI IDBTransactionDurability String where
 72 |     toFFI = show
 73 |
 74 |   export
 75 |   FromFFI IDBTransactionDurability String where
 76 |     fromFFI = read
 77 |
 78 |
 79 | namespace IDBCursorDirection
 80 |
 81 |   public export
 82 |   data IDBCursorDirection = Next | Nextunique | Prev | Prevunique
 83 |
 84 |   public export
 85 |   Show IDBCursorDirection where
 86 |     show Next = "next"
 87 |     show Nextunique = "nextunique"
 88 |     show Prev = "prev"
 89 |     show Prevunique = "prevunique"
 90 |
 91 |   public export
 92 |   Eq IDBCursorDirection where
 93 |     (==) = (==) `on` show
 94 |
 95 |   public export
 96 |   Ord IDBCursorDirection where
 97 |     compare = compare `on` show
 98 |
 99 |   public export
100 |   read : String -> Maybe IDBCursorDirection
101 |   read "next" = Just Next
102 |   read "nextunique" = Just Nextunique
103 |   read "prev" = Just Prev
104 |   read "prevunique" = Just Prevunique
105 |   read _ = Nothing
106 |
107 |   export
108 |   ToFFI IDBCursorDirection String where
109 |     toFFI = show
110 |
111 |   export
112 |   FromFFI IDBCursorDirection String where
113 |     fromFFI = read
114 |
115 |
116 | namespace IDBTransactionMode
117 |
118 |   public export
119 |   data IDBTransactionMode = Readonly | Readwrite | Versionchange
120 |
121 |   public export
122 |   Show IDBTransactionMode where
123 |     show Readonly = "readonly"
124 |     show Readwrite = "readwrite"
125 |     show Versionchange = "versionchange"
126 |
127 |   public export
128 |   Eq IDBTransactionMode where
129 |     (==) = (==) `on` show
130 |
131 |   public export
132 |   Ord IDBTransactionMode where
133 |     compare = compare `on` show
134 |
135 |   public export
136 |   read : String -> Maybe IDBTransactionMode
137 |   read "readonly" = Just Readonly
138 |   read "readwrite" = Just Readwrite
139 |   read "versionchange" = Just Versionchange
140 |   read _ = Nothing
141 |
142 |   export
143 |   ToFFI IDBTransactionMode String where
144 |     toFFI = show
145 |
146 |   export
147 |   FromFFI IDBTransactionMode String where
148 |     fromFFI = read
149 |
150 |
151 |
152 | --------------------------------------------------------------------------------
153 | --          Interfaces
154 | --------------------------------------------------------------------------------
155 |
156 | export data IDBCursor : Type where [external]
157 |
158 | export
159 | ToFFI IDBCursor IDBCursor where toFFI = id
160 |
161 | export
162 | FromFFI IDBCursor IDBCursor where fromFFI = Just
163 |
164 | export
165 | SafeCast IDBCursor where
166 |   safeCast = unsafeCastOnPrototypeName "IDBCursor"
167 |
168 | export data IDBCursorWithValue : Type where [external]
169 |
170 | export
171 | ToFFI IDBCursorWithValue IDBCursorWithValue where toFFI = id
172 |
173 | export
174 | FromFFI IDBCursorWithValue IDBCursorWithValue where fromFFI = Just
175 |
176 | export
177 | SafeCast IDBCursorWithValue where
178 |   safeCast = unsafeCastOnPrototypeName "IDBCursorWithValue"
179 |
180 | export data IDBDatabase : Type where [external]
181 |
182 | export
183 | ToFFI IDBDatabase IDBDatabase where toFFI = id
184 |
185 | export
186 | FromFFI IDBDatabase IDBDatabase where fromFFI = Just
187 |
188 | export
189 | SafeCast IDBDatabase where
190 |   safeCast = unsafeCastOnPrototypeName "IDBDatabase"
191 |
192 | export data IDBFactory : Type where [external]
193 |
194 | export
195 | ToFFI IDBFactory IDBFactory where toFFI = id
196 |
197 | export
198 | FromFFI IDBFactory IDBFactory where fromFFI = Just
199 |
200 | export
201 | SafeCast IDBFactory where
202 |   safeCast = unsafeCastOnPrototypeName "IDBFactory"
203 |
204 | export data IDBIndex : Type where [external]
205 |
206 | export
207 | ToFFI IDBIndex IDBIndex where toFFI = id
208 |
209 | export
210 | FromFFI IDBIndex IDBIndex where fromFFI = Just
211 |
212 | export
213 | SafeCast IDBIndex where
214 |   safeCast = unsafeCastOnPrototypeName "IDBIndex"
215 |
216 | export data IDBKeyRange : Type where [external]
217 |
218 | export
219 | ToFFI IDBKeyRange IDBKeyRange where toFFI = id
220 |
221 | export
222 | FromFFI IDBKeyRange IDBKeyRange where fromFFI = Just
223 |
224 | export
225 | SafeCast IDBKeyRange where
226 |   safeCast = unsafeCastOnPrototypeName "IDBKeyRange"
227 |
228 | export data IDBObjectStore : Type where [external]
229 |
230 | export
231 | ToFFI IDBObjectStore IDBObjectStore where toFFI = id
232 |
233 | export
234 | FromFFI IDBObjectStore IDBObjectStore where fromFFI = Just
235 |
236 | export
237 | SafeCast IDBObjectStore where
238 |   safeCast = unsafeCastOnPrototypeName "IDBObjectStore"
239 |
240 | export data IDBOpenDBRequest : Type where [external]
241 |
242 | export
243 | ToFFI IDBOpenDBRequest IDBOpenDBRequest where toFFI = id
244 |
245 | export
246 | FromFFI IDBOpenDBRequest IDBOpenDBRequest where fromFFI = Just
247 |
248 | export
249 | SafeCast IDBOpenDBRequest where
250 |   safeCast = unsafeCastOnPrototypeName "IDBOpenDBRequest"
251 |
252 | export data IDBRequest : Type where [external]
253 |
254 | export
255 | ToFFI IDBRequest IDBRequest where toFFI = id
256 |
257 | export
258 | FromFFI IDBRequest IDBRequest where fromFFI = Just
259 |
260 | export
261 | SafeCast IDBRequest where
262 |   safeCast = unsafeCastOnPrototypeName "IDBRequest"
263 |
264 | export data IDBTransaction : Type where [external]
265 |
266 | export
267 | ToFFI IDBTransaction IDBTransaction where toFFI = id
268 |
269 | export
270 | FromFFI IDBTransaction IDBTransaction where fromFFI = Just
271 |
272 | export
273 | SafeCast IDBTransaction where
274 |   safeCast = unsafeCastOnPrototypeName "IDBTransaction"
275 |
276 | export data IDBVersionChangeEvent : Type where [external]
277 |
278 | export
279 | ToFFI IDBVersionChangeEvent IDBVersionChangeEvent where toFFI = id
280 |
281 | export
282 | FromFFI IDBVersionChangeEvent IDBVersionChangeEvent where fromFFI = Just
283 |
284 | export
285 | SafeCast IDBVersionChangeEvent where
286 |   safeCast = unsafeCastOnPrototypeName "IDBVersionChangeEvent"
287 |
288 |
289 | --------------------------------------------------------------------------------
290 | --          Dictionaries
291 | --------------------------------------------------------------------------------
292 |
293 | export data IDBDatabaseInfo : Type where [external]
294 |
295 | export
296 | ToFFI IDBDatabaseInfo IDBDatabaseInfo where toFFI = id
297 |
298 | export
299 | FromFFI IDBDatabaseInfo IDBDatabaseInfo where fromFFI = Just
300 |
301 | export data IDBIndexParameters : Type where [external]
302 |
303 | export
304 | ToFFI IDBIndexParameters IDBIndexParameters where toFFI = id
305 |
306 | export
307 | FromFFI IDBIndexParameters IDBIndexParameters where fromFFI = Just
308 |
309 | export data IDBObjectStoreParameters : Type where [external]
310 |
311 | export
312 | ToFFI IDBObjectStoreParameters IDBObjectStoreParameters where toFFI = id
313 |
314 | export
315 | FromFFI IDBObjectStoreParameters IDBObjectStoreParameters where fromFFI = Just
316 |
317 | export data IDBTransactionOptions : Type where [external]
318 |
319 | export
320 | ToFFI IDBTransactionOptions IDBTransactionOptions where toFFI = id
321 |
322 | export
323 | FromFFI IDBTransactionOptions IDBTransactionOptions where fromFFI = Just
324 |
325 | export data IDBVersionChangeEventInit : Type where [external]
326 |
327 | export
328 | ToFFI IDBVersionChangeEventInit IDBVersionChangeEventInit where toFFI = id
329 |
330 | export
331 | FromFFI IDBVersionChangeEventInit IDBVersionChangeEventInit where fromFFI = Just
332 |