@rescript/webapi 0.1.0-pre-alpha-02fb350 → 0.1.0-pre-alpha-4542085
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/package.json +1 -1
- package/src/CSSFontLoadingAPI/FontFace.res +10 -5
- package/src/CSSFontLoadingAPI/FontFaceSet.res +11 -7
- package/src/CanvasAPI/CanvasGradient.res +4 -2
- package/src/CanvasAPI/CanvasPattern.res +4 -3
- package/src/CanvasAPI/FillStyle.res +15 -10
- package/src/CanvasAPI/ImageBitmap.res +4 -2
- package/src/CanvasAPI/ImageBitmapRenderingContext.res +5 -3
- package/src/CanvasAPI/OffscreenCanvas.res +27 -15
- package/src/CanvasAPI/Path2D.res +16 -15
- package/src/ChannelMessagingAPI/MessagePort.res +11 -6
- package/src/ClipboardAPI/Clipboard.res +9 -5
- package/src/CredentialManagementAPI/CredentialsContainer.res +10 -8
- package/src/FetchAPI/BodyInit.res +12 -12
- package/src/FetchAPI/FormData.res +18 -15
- package/src/FetchAPI/FormDataEntryValue.res +11 -9
- package/src/FetchAPI/Headers.res +14 -12
- package/src/FetchAPI/HeadersInit.res +6 -4
- package/src/FetchAPI/Request.res +16 -12
- package/src/FetchAPI/Response.res +27 -24
- package/src/FileAPI/Blob.res +10 -5
- package/src/FileAPI/File.res +8 -7
- package/src/FileAPI/FileSystemDirectoryHandle.res +18 -13
- package/src/FileAPI/FileSystemFileHandle.res +15 -5
- package/src/FileAPI/FileSystemHandle.res +4 -2
- package/src/FileAPI/ReadableStream.res +20 -10
- package/src/FileAPI/WritableStream.res +11 -8
- package/src/FileAPI/WritableStreamDefaultController.res +4 -2
- package/src/Global.res +0 -10
- package/src/HistoryAPI/History.res +9 -6
- package/src/IndexedDBAPI/IDBFactory.res +8 -4
- package/src/PerformanceAPI/Performance.res +18 -17
- package/src/PermissionsAPI/Permissions.res +5 -1
- package/src/ScreenWakeLockAPI/WakeLock.res +5 -1
- package/src/ServiceWorkerAPI/ServiceWorkerContainer.res +10 -9
- package/src/ServiceWorkerAPI/ServiceWorkerGlobalScope.res +6 -2
- package/src/StorageAPI/StorageManager.res +8 -4
- package/src/URLAPI/URL.res +6 -4
- package/src/URLAPI/URLSearchParams.res +18 -16
- package/src/WebCryptoAPI/Crypto.res +6 -2
- package/src/WebLocksAPI/LockManager.res +7 -4
- package/src/WebSocketsAPI/CloseEvent.res +6 -3
- package/src/WebSocketsAPI/MessageEvent.res +10 -9
- package/src/WebSocketsAPI/WebSocket.res +15 -10
- package/src/WebStorageAPI/Storage.res +11 -5
- package/src/WebWorkersAPI/SharedWorkerGlobalScope.res +3 -1
- package/src/WebWorkersAPI/WorkerGlobalScope.res +5 -1
|
@@ -1,70 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
open FileTypes
|
|
3
|
-
open DOMTypes
|
|
1
|
+
module Types = FetchTypes
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData)
|
|
7
|
-
*/
|
|
5
|
+
*/
|
|
8
6
|
@new
|
|
9
|
-
|
|
7
|
+
type t = Types.formData = {...Types.formData}
|
|
8
|
+
type formDataEntryValue = Types.formDataEntryValue
|
|
9
|
+
|
|
10
|
+
external make: (~form: DOMTypes.htmlFormElement=?, ~submitter: DOMTypes.htmlElement=?) => t =
|
|
11
|
+
"FormData"
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/append)
|
|
13
15
|
*/
|
|
14
16
|
@send
|
|
15
|
-
external append: (
|
|
17
|
+
external append: (t, ~name: string, ~value: string) => unit = "append"
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/append)
|
|
19
21
|
*/
|
|
20
22
|
@send
|
|
21
|
-
external appendBlob: (
|
|
23
|
+
external appendBlob: (t, ~name: string, ~blobValue: FileTypes.blob, ~filename: string=?) => unit =
|
|
22
24
|
"append"
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/delete)
|
|
26
28
|
*/
|
|
27
29
|
@send
|
|
28
|
-
external delete: (
|
|
30
|
+
external delete: (t, string) => unit = "delete"
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/get)
|
|
32
34
|
*/
|
|
33
35
|
@send
|
|
34
|
-
external get: (
|
|
36
|
+
external get: (t, string) => null<formDataEntryValue> = "get"
|
|
35
37
|
|
|
36
38
|
/**
|
|
37
39
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/getAll)
|
|
38
40
|
*/
|
|
39
41
|
@send
|
|
40
|
-
external getAll: (
|
|
42
|
+
external getAll: (t, string) => array<formDataEntryValue> = "getAll"
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/has)
|
|
44
46
|
*/
|
|
45
47
|
@send
|
|
46
|
-
external has: (
|
|
48
|
+
external has: (t, string) => bool = "has"
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
51
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/entries)
|
|
50
52
|
*/
|
|
51
53
|
@send
|
|
52
|
-
external entries:
|
|
54
|
+
external entries: t => Iterator.t<(string, formDataEntryValue)> = "entries"
|
|
53
55
|
|
|
54
56
|
/**
|
|
55
57
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/keys)
|
|
56
58
|
*/
|
|
57
59
|
@send
|
|
58
|
-
external keys:
|
|
60
|
+
external keys: t => Iterator.t<string> = "keys"
|
|
59
61
|
|
|
60
62
|
/**
|
|
61
63
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/set)
|
|
62
64
|
*/
|
|
63
65
|
@send
|
|
64
|
-
external set: (
|
|
66
|
+
external set: (t, ~name: string, ~value: string) => unit = "set"
|
|
65
67
|
|
|
66
68
|
/**
|
|
67
69
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/set)
|
|
68
70
|
*/
|
|
69
71
|
@send
|
|
70
|
-
external setBlob: (
|
|
72
|
+
external setBlob: (t, ~name: string, ~blobValue: FileTypes.blob, ~filename: string=?) => unit =
|
|
73
|
+
"set"
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
open Prelude
|
|
2
|
-
open FetchTypes
|
|
3
|
-
open FileTypes
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
module Types = FetchTypes
|
|
4
|
+
|
|
5
|
+
type t = Types.formDataEntryValue
|
|
6
|
+
|
|
7
|
+
external fromString: string => t = "%identity"
|
|
8
|
+
external fromFile: FileTypes.file => t = "%identity"
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
Represents a decoded version of the abstract `formDataEntryValue` type.
|
|
@@ -11,12 +13,12 @@ A FormData entry value is either a string or a File.
|
|
|
11
13
|
*/
|
|
12
14
|
type decoded =
|
|
13
15
|
| String(string)
|
|
14
|
-
| File(file)
|
|
16
|
+
| File(FileTypes.file)
|
|
15
17
|
|
|
16
|
-
let decode = (
|
|
17
|
-
if File.isInstanceOf(
|
|
18
|
-
File(unsafeConversation(
|
|
18
|
+
let decode = (value: t): decoded => {
|
|
19
|
+
if File.isInstanceOf(value) {
|
|
20
|
+
File(unsafeConversation(value))
|
|
19
21
|
} else {
|
|
20
|
-
String(unsafeConversation(
|
|
22
|
+
String(unsafeConversation(value))
|
|
21
23
|
}
|
|
22
24
|
}
|
package/src/FetchAPI/Headers.res
CHANGED
|
@@ -1,61 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
module Types = FetchTypes
|
|
2
|
+
|
|
3
|
+
type t = Types.headers = {...Types.headers}
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Headers)
|
|
5
|
-
*/
|
|
7
|
+
*/
|
|
6
8
|
@new
|
|
7
|
-
external make: unit =>
|
|
9
|
+
external make: unit => t = "Headers"
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Headers)
|
|
11
13
|
*/
|
|
12
14
|
@new
|
|
13
|
-
external fromDict: dict<string> =>
|
|
15
|
+
external fromDict: dict<string> => t = "Headers"
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Headers)
|
|
17
19
|
*/
|
|
18
20
|
@new
|
|
19
|
-
external fromHeaders:
|
|
21
|
+
external fromHeaders: t => t = "Headers"
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Headers)
|
|
23
25
|
*/
|
|
24
26
|
@new
|
|
25
|
-
external fromKeyValueArray: array<(string, string)> =>
|
|
27
|
+
external fromKeyValueArray: array<(string, string)> => t = "Headers"
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Headers/append)
|
|
29
31
|
*/
|
|
30
32
|
@send
|
|
31
|
-
external append: (
|
|
33
|
+
external append: (t, ~name: string, ~value: string) => unit = "append"
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Headers/delete)
|
|
35
37
|
*/
|
|
36
38
|
@send
|
|
37
|
-
external delete: (
|
|
39
|
+
external delete: (t, string) => unit = "delete"
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
42
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Headers/get)
|
|
41
43
|
*/
|
|
42
44
|
@send
|
|
43
|
-
external get: (
|
|
45
|
+
external get: (t, string) => null<string> = "get"
|
|
44
46
|
|
|
45
47
|
/**
|
|
46
48
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
|
|
47
49
|
*/
|
|
48
50
|
@send
|
|
49
|
-
external getSetCookie:
|
|
51
|
+
external getSetCookie: t => array<string> = "getSetCookie"
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Headers/has)
|
|
53
55
|
*/
|
|
54
56
|
@send
|
|
55
|
-
external has: (
|
|
57
|
+
external has: (t, string) => bool = "has"
|
|
56
58
|
|
|
57
59
|
/**
|
|
58
60
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Headers/set)
|
|
59
61
|
*/
|
|
60
62
|
@send
|
|
61
|
-
external set: (
|
|
63
|
+
external set: (t, ~name: string, ~value: string) => unit = "set"
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
module Types = FetchTypes
|
|
2
|
+
|
|
3
|
+
type t = Types.headersInit
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#setting_headers)
|
|
5
7
|
*/
|
|
6
|
-
external fromDict: dict<string> =>
|
|
8
|
+
external fromDict: dict<string> => t = "%identity"
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#setting_headers)
|
|
10
12
|
*/
|
|
11
|
-
external fromHeaders: headers =>
|
|
13
|
+
external fromHeaders: Types.headers => t = "%identity"
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#setting_headers)
|
|
15
17
|
*/
|
|
16
|
-
external fromKeyValueArray: array<(string, string)> =>
|
|
18
|
+
external fromKeyValueArray: array<(string, string)> => t = "%identity"
|
package/src/FetchAPI/Request.res
CHANGED
|
@@ -1,56 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
module Types = FetchTypes
|
|
2
|
+
|
|
3
|
+
type t = Types.request = {...Types.request}
|
|
4
|
+
type requestInit = Types.requestInit = {...Types.requestInit}
|
|
5
|
+
type bodyInit = Types.bodyInit
|
|
6
|
+
type headersInit = Types.headersInit
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request)
|
|
6
|
-
*/
|
|
10
|
+
*/
|
|
7
11
|
@new
|
|
8
|
-
external fromURL: (string, ~init: requestInit=?) =>
|
|
12
|
+
external fromURL: (string, ~init: requestInit=?) => t = "Request"
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request)
|
|
12
16
|
*/
|
|
13
17
|
@new
|
|
14
|
-
external fromRequest: (
|
|
18
|
+
external fromRequest: (t, ~init: requestInit=?) => t = "Request"
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer)
|
|
18
22
|
*/
|
|
19
23
|
@send
|
|
20
|
-
external arrayBuffer:
|
|
24
|
+
external arrayBuffer: t => promise<ArrayBuffer.t> = "arrayBuffer"
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/blob)
|
|
24
28
|
*/
|
|
25
29
|
@send
|
|
26
|
-
external blob:
|
|
30
|
+
external blob: t => promise<FileTypes.blob> = "blob"
|
|
27
31
|
|
|
28
32
|
/**
|
|
29
33
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/bytes)
|
|
30
34
|
*/
|
|
31
35
|
@send
|
|
32
|
-
external bytes:
|
|
36
|
+
external bytes: t => promise<array<int>> = "bytes"
|
|
33
37
|
|
|
34
38
|
/**
|
|
35
39
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/formData)
|
|
36
40
|
*/
|
|
37
41
|
@send
|
|
38
|
-
external formData:
|
|
42
|
+
external formData: t => promise<Types.formData> = "formData"
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/json)
|
|
42
46
|
*/
|
|
43
47
|
@send
|
|
44
|
-
external json:
|
|
48
|
+
external json: t => promise<JSON.t> = "json"
|
|
45
49
|
|
|
46
50
|
/**
|
|
47
51
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/text)
|
|
48
52
|
*/
|
|
49
53
|
@send
|
|
50
|
-
external text:
|
|
54
|
+
external text: t => promise<string> = "text"
|
|
51
55
|
|
|
52
56
|
/**
|
|
53
57
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/clone)
|
|
54
58
|
*/
|
|
55
59
|
@send
|
|
56
|
-
external clone:
|
|
60
|
+
external clone: t => t = "clone"
|
|
@@ -1,123 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
module Types = FetchTypes
|
|
2
|
+
|
|
3
|
+
type t = Types.response = {...Types.response}
|
|
4
|
+
type responseInit = Types.responseInit = {...Types.responseInit}
|
|
5
|
+
type bodyInit = Types.bodyInit
|
|
6
|
+
type headersInit = Types.headersInit
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
7
|
-
*/
|
|
10
|
+
*/
|
|
8
11
|
@new
|
|
9
|
-
external fromNull: (@as(json`null`) _, ~init: responseInit=?) =>
|
|
12
|
+
external fromNull: (@as(json`null`) _, ~init: responseInit=?) => t = "Response"
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
13
16
|
*/
|
|
14
17
|
@new
|
|
15
|
-
external fromString: (string, ~init: responseInit=?) =>
|
|
18
|
+
external fromString: (string, ~init: responseInit=?) => t = "Response"
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
19
22
|
*/
|
|
20
23
|
@new
|
|
21
|
-
external fromArrayBuffer: (ArrayBuffer.t, ~init: responseInit=?) =>
|
|
24
|
+
external fromArrayBuffer: (ArrayBuffer.t, ~init: responseInit=?) => t = "Response"
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
25
28
|
*/
|
|
26
29
|
@new
|
|
27
|
-
external fromTypedArray: (TypedArray.t<'t>, ~init: responseInit=?) =>
|
|
30
|
+
external fromTypedArray: (TypedArray.t<'t>, ~init: responseInit=?) => t = "Response"
|
|
28
31
|
|
|
29
32
|
/**
|
|
30
33
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
31
34
|
*/
|
|
32
35
|
@new
|
|
33
|
-
external fromDataView: (DataView.t, ~init: responseInit=?) =>
|
|
36
|
+
external fromDataView: (DataView.t, ~init: responseInit=?) => t = "Response"
|
|
34
37
|
|
|
35
38
|
/**
|
|
36
39
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
37
40
|
*/
|
|
38
41
|
@new
|
|
39
|
-
external fromBlob: (blob, ~init: responseInit=?) =>
|
|
42
|
+
external fromBlob: (FileTypes.blob, ~init: responseInit=?) => t = "Response"
|
|
40
43
|
|
|
41
44
|
/**
|
|
42
45
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
43
46
|
*/
|
|
44
47
|
@new
|
|
45
|
-
external fromFile: (file, ~init: responseInit=?) =>
|
|
48
|
+
external fromFile: (FileTypes.file, ~init: responseInit=?) => t = "Response"
|
|
46
49
|
|
|
47
50
|
/**
|
|
48
51
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
49
52
|
*/
|
|
50
53
|
@new
|
|
51
|
-
external fromURLSearchParams: (urlSearchParams, ~init: responseInit=?) =>
|
|
54
|
+
external fromURLSearchParams: (URLTypes.urlSearchParams, ~init: responseInit=?) => t = "Response"
|
|
52
55
|
|
|
53
56
|
/**
|
|
54
57
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
55
58
|
*/
|
|
56
59
|
@new
|
|
57
|
-
external fromFormData: (formData, ~init: responseInit=?) =>
|
|
60
|
+
external fromFormData: (Types.formData, ~init: responseInit=?) => t = "Response"
|
|
58
61
|
|
|
59
62
|
/**
|
|
60
63
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
61
64
|
*/
|
|
62
65
|
@new
|
|
63
|
-
external fromReadableStream: (readableStream<'t>, ~init: responseInit=?) =>
|
|
66
|
+
external fromReadableStream: (FileTypes.readableStream<'t>, ~init: responseInit=?) => t = "Response"
|
|
64
67
|
|
|
65
68
|
/**
|
|
66
69
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer)
|
|
67
70
|
*/
|
|
68
71
|
@send
|
|
69
|
-
external arrayBuffer:
|
|
72
|
+
external arrayBuffer: t => promise<ArrayBuffer.t> = "arrayBuffer"
|
|
70
73
|
|
|
71
74
|
/**
|
|
72
75
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/blob)
|
|
73
76
|
*/
|
|
74
77
|
@send
|
|
75
|
-
external blob:
|
|
78
|
+
external blob: t => promise<FileTypes.blob> = "blob"
|
|
76
79
|
|
|
77
80
|
/**
|
|
78
81
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/bytes)
|
|
79
82
|
*/
|
|
80
83
|
@send
|
|
81
|
-
external bytes:
|
|
84
|
+
external bytes: t => promise<array<int>> = "bytes"
|
|
82
85
|
|
|
83
86
|
/**
|
|
84
87
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/formData)
|
|
85
88
|
*/
|
|
86
89
|
@send
|
|
87
|
-
external formData:
|
|
90
|
+
external formData: t => promise<Types.formData> = "formData"
|
|
88
91
|
|
|
89
92
|
/**
|
|
90
93
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/json)
|
|
91
94
|
*/
|
|
92
95
|
@send
|
|
93
|
-
external json:
|
|
96
|
+
external json: t => promise<JSON.t> = "json"
|
|
94
97
|
|
|
95
98
|
/**
|
|
96
99
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/text)
|
|
97
100
|
*/
|
|
98
101
|
@send
|
|
99
|
-
external text:
|
|
102
|
+
external text: t => promise<string> = "text"
|
|
100
103
|
|
|
101
104
|
/**
|
|
102
105
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response/error_static)
|
|
103
106
|
*/
|
|
104
107
|
@scope("Response")
|
|
105
|
-
external error: unit =>
|
|
108
|
+
external error: unit => t = "error"
|
|
106
109
|
|
|
107
110
|
/**
|
|
108
111
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response/redirect_static)
|
|
109
112
|
*/
|
|
110
113
|
@scope("Response")
|
|
111
|
-
external redirect: (~url: string, ~status: int=?) =>
|
|
114
|
+
external redirect: (~url: string, ~status: int=?) => t = "redirect"
|
|
112
115
|
|
|
113
116
|
/**
|
|
114
117
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response/json_static)
|
|
115
118
|
*/
|
|
116
119
|
@scope("Response")
|
|
117
|
-
external jsonR: (~data: JSON.t, ~init: responseInit=?) =>
|
|
120
|
+
external jsonR: (~data: JSON.t, ~init: responseInit=?) => t = "json"
|
|
118
121
|
|
|
119
122
|
/**
|
|
120
123
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response/clone)
|
|
121
124
|
*/
|
|
122
125
|
@send
|
|
123
|
-
external clone:
|
|
126
|
+
external clone: t => t = "clone"
|
package/src/FileAPI/Blob.res
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
module Types = FileTypes
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Blob)
|
|
5
5
|
*/
|
|
6
6
|
@new
|
|
7
|
-
|
|
7
|
+
type t = Types.blob = {...Types.blob}
|
|
8
|
+
type blobPart = Types.blobPart
|
|
9
|
+
type blobPropertyBag = Types.blobPropertyBag = {...Types.blobPropertyBag}
|
|
10
|
+
type readableStream<'r> = Types.readableStream<'r> = {...Types.readableStream<'r>}
|
|
11
|
+
|
|
12
|
+
external make: (~blobParts: array<blobPart>=?, ~options: blobPropertyBag=?) => t = "Blob"
|
|
8
13
|
|
|
9
14
|
module Impl = (
|
|
10
15
|
T: {
|
|
11
16
|
type t
|
|
12
17
|
},
|
|
13
18
|
) => {
|
|
14
|
-
external asBlob: T.t =>
|
|
19
|
+
external asBlob: T.t => t = "%identity"
|
|
15
20
|
/**
|
|
16
21
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Blob/slice)
|
|
17
22
|
*/
|
|
18
23
|
@send
|
|
19
|
-
external slice: (T.t, ~start: int=?, ~end: int=?, ~contentType: string=?) =>
|
|
24
|
+
external slice: (T.t, ~start: int=?, ~end: int=?, ~contentType: string=?) => t = "slice"
|
|
20
25
|
|
|
21
26
|
/**
|
|
22
27
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Blob/stream)
|
|
@@ -43,4 +48,4 @@ module Impl = (
|
|
|
43
48
|
external bytes: T.t => promise<array<int>> = "bytes"
|
|
44
49
|
}
|
|
45
50
|
|
|
46
|
-
include Impl({type t =
|
|
51
|
+
include Impl({type t = t})
|
package/src/FileAPI/File.res
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
module Types = FileTypes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type t = Types.file = {...Types.file}
|
|
4
|
+
type blobPart = Types.blobPart
|
|
5
|
+
type filePropertyBag = Types.filePropertyBag = {...Types.filePropertyBag}
|
|
6
|
+
|
|
7
|
+
include Blob.Impl({type t = t})
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
10
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/File)
|
|
7
11
|
*/
|
|
8
12
|
@new
|
|
9
|
-
external make: (
|
|
10
|
-
|
|
11
|
-
~fileName: string,
|
|
12
|
-
~options: filePropertyBag=?,
|
|
13
|
-
) => file = "File"
|
|
13
|
+
external make: (~fileBits: array<blobPart>, ~fileName: string, ~options: filePropertyBag=?) => t =
|
|
14
|
+
"File"
|
|
14
15
|
|
|
15
16
|
let isInstanceOf = (_: 't): bool => %raw(`param instanceof File`)
|
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
module Types = FileTypes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type t = Types.fileSystemDirectoryHandle = {...Types.fileSystemDirectoryHandle}
|
|
4
|
+
type fileSystemHandle = Types.fileSystemHandle = {...Types.fileSystemHandle}
|
|
5
|
+
type fileSystemFileHandle = Types.fileSystemFileHandle = {...Types.fileSystemFileHandle}
|
|
6
|
+
type fileSystemGetFileOptions = Types.fileSystemGetFileOptions = {...Types.fileSystemGetFileOptions}
|
|
7
|
+
type fileSystemGetDirectoryOptions = Types.fileSystemGetDirectoryOptions = {
|
|
8
|
+
...Types.fileSystemGetDirectoryOptions,
|
|
9
|
+
}
|
|
10
|
+
type fileSystemRemoveOptions = Types.fileSystemRemoveOptions = {...Types.fileSystemRemoveOptions}
|
|
11
|
+
|
|
12
|
+
external asFileSystemHandle: t => fileSystemHandle = "%identity"
|
|
4
13
|
/**
|
|
5
14
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/isSameEntry)
|
|
6
15
|
*/
|
|
7
16
|
@send
|
|
8
|
-
external isSameEntry: (
|
|
17
|
+
external isSameEntry: (t, fileSystemHandle) => promise<bool> = "isSameEntry"
|
|
9
18
|
|
|
10
19
|
/**
|
|
11
20
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/getFileHandle)
|
|
12
21
|
*/
|
|
13
22
|
@send
|
|
14
23
|
external getFileHandle: (
|
|
15
|
-
|
|
24
|
+
t,
|
|
16
25
|
~name: string,
|
|
17
26
|
~options: fileSystemGetFileOptions=?,
|
|
18
27
|
) => promise<fileSystemFileHandle> = "getFileHandle"
|
|
@@ -22,24 +31,20 @@ external getFileHandle: (
|
|
|
22
31
|
*/
|
|
23
32
|
@send
|
|
24
33
|
external getDirectoryHandle: (
|
|
25
|
-
|
|
34
|
+
t,
|
|
26
35
|
~name: string,
|
|
27
36
|
~options: fileSystemGetDirectoryOptions=?,
|
|
28
|
-
) => promise<
|
|
37
|
+
) => promise<t> = "getDirectoryHandle"
|
|
29
38
|
|
|
30
39
|
/**
|
|
31
40
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/removeEntry)
|
|
32
41
|
*/
|
|
33
42
|
@send
|
|
34
|
-
external removeEntry: (
|
|
35
|
-
|
|
36
|
-
~name: string,
|
|
37
|
-
~options: fileSystemRemoveOptions=?,
|
|
38
|
-
) => promise<unit> = "removeEntry"
|
|
43
|
+
external removeEntry: (t, ~name: string, ~options: fileSystemRemoveOptions=?) => promise<unit> =
|
|
44
|
+
"removeEntry"
|
|
39
45
|
|
|
40
46
|
/**
|
|
41
47
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/resolve)
|
|
42
48
|
*/
|
|
43
49
|
@send
|
|
44
|
-
external resolve: (
|
|
45
|
-
"resolve"
|
|
50
|
+
external resolve: (t, fileSystemHandle) => promise<array<string>> = "resolve"
|
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
module Types = FileTypes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type t = Types.fileSystemFileHandle = {...Types.fileSystemFileHandle}
|
|
4
|
+
type fileSystemHandle = Types.fileSystemHandle = {...Types.fileSystemHandle}
|
|
5
|
+
type file = Types.file = {...Types.file}
|
|
6
|
+
type fileSystemCreateWritableOptions = Types.fileSystemCreateWritableOptions = {
|
|
7
|
+
...Types.fileSystemCreateWritableOptions,
|
|
8
|
+
}
|
|
9
|
+
type fileSystemWritableFileStream = Types.fileSystemWritableFileStream = {
|
|
10
|
+
...Types.fileSystemWritableFileStream,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
external asFileSystemHandle: t => fileSystemHandle = "%identity"
|
|
4
14
|
/**
|
|
5
15
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/isSameEntry)
|
|
6
16
|
*/
|
|
7
17
|
@send
|
|
8
|
-
external isSameEntry: (
|
|
18
|
+
external isSameEntry: (t, fileSystemHandle) => promise<bool> = "isSameEntry"
|
|
9
19
|
|
|
10
20
|
/**
|
|
11
21
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle/getFile)
|
|
12
22
|
*/
|
|
13
23
|
@send
|
|
14
|
-
external getFile:
|
|
24
|
+
external getFile: t => promise<file> = "getFile"
|
|
15
25
|
|
|
16
26
|
/**
|
|
17
27
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle/createWritable)
|
|
18
28
|
*/
|
|
19
29
|
@send
|
|
20
30
|
external createWritable: (
|
|
21
|
-
|
|
31
|
+
t,
|
|
22
32
|
~options: fileSystemCreateWritableOptions=?,
|
|
23
33
|
) => promise<fileSystemWritableFileStream> = "createWritable"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
module Types = FileTypes
|
|
2
|
+
|
|
3
|
+
type t = Types.fileSystemHandle = {...Types.fileSystemHandle}
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/isSameEntry)
|
|
5
7
|
*/
|
|
6
8
|
@send
|
|
7
|
-
external isSameEntry: (
|
|
9
|
+
external isSameEntry: (t, t) => promise<bool> = "isSameEntry"
|