@colisweb/rescript-toolkit 5.8.0 → 5.9.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/.gitlab-ci.yml +1 -1
- package/.secure_files/{ci-functions-v17.7.2 → ci-functions-v17.12.0} +116 -64
- package/.secure_files/{ci-functions-v17.7.0 → ci-functions-v17.12.0-feat-add-mysql-service-1.0.1beta} +138 -83
- package/.secure_files/{ci-functions-v17.7.1 → ci-functions-v17.12.0-feat-add-mysql-service-1.0.2beta} +138 -83
- package/.secure_files/{ci-functions-v17.2.4 → ci-functions-v17.12.0-feat-add-mysql-service-1.0.3beta} +214 -103
- package/.secure_files/ci-functions-v17.12.0-feat-add-mysql-service-1.0.4beta +2658 -0
- package/.secure_files/ci-functions-v17.12.0-feat-add-mysql-service-1.0.5beta +2658 -0
- package/.secure_files/ci-functions-v17.12.0-feat-add-mysql-service-1.0.6beta +2658 -0
- package/.secure_files/ci-functions-v17.12.0-feat-add-mysql-service-1.0.7beta +2658 -0
- package/.secure_files/ci-functions-v17.13.0 +2659 -0
- package/.secure_files/ci-functions-v17.14.0 +2659 -0
- package/package.json +2 -2
- package/src/request/index.md +79 -82
- package/src/vendors/Here.res +99 -0
- package/.secure_files/ci-functions-v17.2.1 +0 -2547
- package/.secure_files/ci-functions-v17.2.2 +0 -2547
- package/.secure_files/ci-functions-v17.2.3 +0 -2547
- package/.secure_files/ci-functions-v17.3.0 +0 -2547
- package/.secure_files/ci-functions-v17.3.1 +0 -2547
- package/.secure_files/ci-functions-v17.3.2 +0 -2547
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colisweb/rescript-toolkit",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rescript clean",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@colisweb/bs-react-intl-extractor-bin": "0.12.2",
|
|
31
31
|
"@datadog/browser-rum": "5.8.0",
|
|
32
|
-
"@dck/rescript-ky": "2.0.
|
|
32
|
+
"@dck/rescript-ky": "2.0.4",
|
|
33
33
|
"@dck/rescript-promise": "1.1.0",
|
|
34
34
|
"@dck/restorative": "1.1.0",
|
|
35
35
|
"@greenlabs/ppx-spice": "0.2.1",
|
package/src/request/index.md
CHANGED
|
@@ -4,100 +4,97 @@
|
|
|
4
4
|
|
|
5
5
|
```rescript
|
|
6
6
|
module API = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[@spice]
|
|
12
|
-
type response = array(user)
|
|
13
|
-
[@spice]
|
|
14
|
-
and user = {
|
|
15
|
-
name: string
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
type error = string;
|
|
19
|
-
|
|
20
|
-
let exec = clientId => {
|
|
21
|
-
request->Request.get(baseUrl(~clientId), response_decode);
|
|
22
|
-
};
|
|
23
|
-
};
|
|
7
|
+
let kyInstance = Ky.Instance.create({
|
|
8
|
+
prefixUrl: `${ColiswebApi__Env.v6ApiUrl}`,
|
|
9
|
+
timeout: ColiswebApi__Env.isNodeDevelopment ? 5000 : 20000,
|
|
10
|
+
})
|
|
24
11
|
|
|
25
|
-
|
|
12
|
+
module FetchUsers = {
|
|
13
|
+
type argument = ()
|
|
14
|
+
|
|
15
|
+
@spice
|
|
16
|
+
type user = {
|
|
17
|
+
id: string,
|
|
18
|
+
name: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@spice
|
|
22
|
+
type response = {
|
|
23
|
+
users: array<user>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type error = unit
|
|
27
|
+
|
|
28
|
+
let config = () => {
|
|
29
|
+
kyInstance,
|
|
30
|
+
requestOptions: {
|
|
31
|
+
method: Ky.HttpMethod.GET,
|
|
32
|
+
},
|
|
33
|
+
key: [
|
|
34
|
+
"FetchUser"
|
|
35
|
+
],
|
|
36
|
+
path: `/users`,
|
|
37
|
+
}
|
|
26
38
|
};
|
|
27
39
|
};
|
|
28
40
|
|
|
29
|
-
API.FetchUsers
|
|
41
|
+
let (data, isLoading, _) = Request.useFetcher(module(API.FetchUsers), Some())
|
|
42
|
+
|
|
43
|
+
Request.fetchAPI(module(API.FetchUsers), Some())
|
|
44
|
+
->Promise.tapOk(({users}) => Js.log(users))
|
|
30
45
|
```
|
|
31
46
|
|
|
32
47
|
### Handle custom error
|
|
33
48
|
|
|
34
49
|
```rescript
|
|
35
50
|
module API = {
|
|
51
|
+
let kyInstance = Ky.Instance.create({
|
|
52
|
+
prefixUrl: `${ColiswebApi__Env.v6ApiUrl}`,
|
|
53
|
+
timeout: ColiswebApi__Env.isNodeDevelopment ? 5000 : 20000,
|
|
54
|
+
})
|
|
55
|
+
|
|
36
56
|
module FetchUsers = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
let codec: Spice.codec(errorType) = (encoder, decoder);
|
|
70
|
-
|
|
71
|
-
[@spice]
|
|
72
|
-
type t = [@spice.codec codec] errorType;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
module Config = {
|
|
76
|
-
type argument = unit;
|
|
77
|
-
|
|
78
|
-
[@spice]
|
|
79
|
-
type response = array(user)
|
|
80
|
-
[@spice]
|
|
81
|
-
and user = {
|
|
82
|
-
name: string
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
[@spice]
|
|
86
|
-
type error = Error.t;
|
|
87
|
-
|
|
88
|
-
let exec = clientId => {
|
|
89
|
-
request->Request.get(baseUrl(~clientId), ~errorDecoder=error_decode,response_decode);
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
module Request = Toolkit.Request.Make(Config);
|
|
57
|
+
type argument = ()
|
|
58
|
+
|
|
59
|
+
@spice
|
|
60
|
+
type user = {
|
|
61
|
+
id: string,
|
|
62
|
+
name: string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@spice
|
|
66
|
+
type response = {
|
|
67
|
+
users: array<user>
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
type error = Anything
|
|
71
|
+
|
|
72
|
+
let config = () => {
|
|
73
|
+
kyInstance,
|
|
74
|
+
requestOptions: {
|
|
75
|
+
method: Ky.HttpMethod.GET,
|
|
76
|
+
},
|
|
77
|
+
key: [
|
|
78
|
+
"FetchUser"
|
|
79
|
+
],
|
|
80
|
+
path: `/users`,
|
|
81
|
+
mapCustomErrors: error =>
|
|
82
|
+
switch error.response {
|
|
83
|
+
| Some({status: 409}) => Custom(Anything)
|
|
84
|
+
| _ => Unknown(error)
|
|
85
|
+
}->Promise.resolved,
|
|
86
|
+
}
|
|
94
87
|
};
|
|
95
88
|
};
|
|
96
89
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
90
|
+
|
|
91
|
+
Request.fetchAPI(module(API.FetchUsers), Some())
|
|
92
|
+
->Promise.tapOk(({users}) => Js.log(users))
|
|
93
|
+
->Promise.tapError(error => {
|
|
94
|
+
switch error {
|
|
95
|
+
| Custom(Anything) => ...
|
|
96
|
+
| DecodeError(spiceError) => ...
|
|
97
|
+
| Unknown(kyError) => ...
|
|
98
|
+
}
|
|
99
|
+
})
|
|
103
100
|
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
type coordinates = {
|
|
2
|
+
lat: float,
|
|
3
|
+
lng: float,
|
|
4
|
+
}
|
|
5
|
+
module Layers = {
|
|
6
|
+
type map
|
|
7
|
+
|
|
8
|
+
type rec t = {vector: vector}
|
|
9
|
+
and vector = {normal: normalVector}
|
|
10
|
+
and normalVector = {map: map}
|
|
11
|
+
}
|
|
12
|
+
module Platform = {
|
|
13
|
+
type t
|
|
14
|
+
type options = {apikey: string}
|
|
15
|
+
|
|
16
|
+
@new
|
|
17
|
+
external make: options => t = "H.service.Platform"
|
|
18
|
+
|
|
19
|
+
type layersOptions = {pois: bool}
|
|
20
|
+
|
|
21
|
+
@send
|
|
22
|
+
external createDefaultLayers: (t, layersOptions) => Layers.t = "createDefaultLayers"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module Map = {
|
|
26
|
+
type instance
|
|
27
|
+
|
|
28
|
+
type options = {
|
|
29
|
+
zoom: int,
|
|
30
|
+
center: coordinates,
|
|
31
|
+
}
|
|
32
|
+
@new
|
|
33
|
+
external make: (Dom.element, Layers.map, options) => instance = "H.Map"
|
|
34
|
+
|
|
35
|
+
module Marker = {
|
|
36
|
+
type t
|
|
37
|
+
|
|
38
|
+
@new
|
|
39
|
+
external make: coordinates => t = "H.map.Marker"
|
|
40
|
+
|
|
41
|
+
@send
|
|
42
|
+
external setData: (t, string) => unit = "setData"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module Viewport = {
|
|
46
|
+
type t
|
|
47
|
+
|
|
48
|
+
@send
|
|
49
|
+
external resize: (t, unit) => unit = "resize"
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module Group = {
|
|
53
|
+
type t
|
|
54
|
+
@new
|
|
55
|
+
external make: unit => t = "H.map.Group"
|
|
56
|
+
|
|
57
|
+
@send
|
|
58
|
+
external addEventListener: (t, string, 'event => unit) => unit = "addEventListener"
|
|
59
|
+
|
|
60
|
+
@send
|
|
61
|
+
external addMarker: (t, Marker.t) => unit = "addObject"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@send
|
|
65
|
+
external addMarker: (instance, Marker.t) => unit = "addObject"
|
|
66
|
+
@send
|
|
67
|
+
external addGroup: (instance, Group.t) => unit = "addObject"
|
|
68
|
+
|
|
69
|
+
@send
|
|
70
|
+
external getViewPort: (instance, unit) => Viewport.t = "getViewPort"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module MapEvents = {
|
|
74
|
+
type t
|
|
75
|
+
|
|
76
|
+
@new
|
|
77
|
+
external make: Map.instance => t = "H.mapevents.MapEvents"
|
|
78
|
+
}
|
|
79
|
+
module Behavior = {
|
|
80
|
+
type t
|
|
81
|
+
|
|
82
|
+
@new
|
|
83
|
+
external make: MapEvents.t => t = "H.mapevents.Behavior"
|
|
84
|
+
}
|
|
85
|
+
module Ui = {
|
|
86
|
+
type t
|
|
87
|
+
|
|
88
|
+
@new
|
|
89
|
+
external createDefault: (Map.instance, Layers.t) => t = "H.ui.UI.createDefault"
|
|
90
|
+
|
|
91
|
+
module InfoBubble = {
|
|
92
|
+
type t
|
|
93
|
+
@new
|
|
94
|
+
external make: ('geometry, 'data) => t = "H.ui.InfoBubble"
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@send
|
|
98
|
+
external addBubble: (t, InfoBubble.t) => unit = "addBubble"
|
|
99
|
+
}
|