@colisweb/rescript-toolkit 2.11.2 → 2.13.2
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 -2
- package/bsconfig.json +1 -3
- package/package.json +2 -2
- package/src/Toolkit.res +2 -0
- package/src/logger/Toolkit__BrowserLogger.res +74 -0
- package/src/logger/Toolkit__BrowserLogger.resi +8 -0
- package/src/logger/Toolkit__NativeLogger.res +54 -0
- package/src/logger/Toolkit__NativeLogger.resi +8 -0
- package/src/logger/index.md +16 -0
- package/src/request/Toolkit__Request.res +3 -196
- package/src/unleash/Toolkit__Unleash.res +1 -1
- package/src/vendors/{Axios2.res → Axios.res} +0 -0
- package/src/fetcher/Toolkit__Fetcher2.res +0 -28
- package/src/request/Toolkit__Request2.res +0 -12
- package/src/sentry/SentryLogger.res +0 -114
- package/src/sentry/SentryReactNativeLogger.res +0 -114
- package/src/sentry/index.md +0 -3
package/.gitlab-ci.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
include:
|
|
2
|
-
- "https://colisweb-open-source.gitlab.io/ci-common/v13.
|
|
2
|
+
- "https://colisweb-open-source.gitlab.io/ci-common/v13.11.1/templates/colisweb.yml"
|
|
3
3
|
|
|
4
4
|
# -----------------------------------------------
|
|
5
5
|
# Test
|
|
@@ -16,7 +16,6 @@ rescript compilation:
|
|
|
16
16
|
- .yarn/
|
|
17
17
|
script:
|
|
18
18
|
- export NPM_TOKEN=${NPM_TOKEN:-undefined}
|
|
19
|
-
- echo $NPM_TOKEN
|
|
20
19
|
- yarn install --cache-folder .yarn --pure-lockfile
|
|
21
20
|
- yarn test
|
|
22
21
|
|
package/bsconfig.json
CHANGED
|
@@ -26,17 +26,15 @@
|
|
|
26
26
|
"bs-css",
|
|
27
27
|
"bs-css-emotion",
|
|
28
28
|
"@rescript/react",
|
|
29
|
-
"bs-axios",
|
|
30
29
|
"reason-promise",
|
|
31
30
|
"reason-react",
|
|
32
31
|
"decco",
|
|
33
32
|
"rescript-classnames",
|
|
34
|
-
"rescript-logger",
|
|
35
33
|
"reschema",
|
|
36
34
|
"rescript-react-update",
|
|
37
35
|
"restorative"
|
|
38
36
|
],
|
|
39
|
-
"ppx-flags": ["decco/ppx", "lenses-ppx/ppx"
|
|
37
|
+
"ppx-flags": ["decco/ppx", "lenses-ppx/ppx"],
|
|
40
38
|
"refmt": 3,
|
|
41
39
|
"warnings": {
|
|
42
40
|
"number": "-44-30-32",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colisweb/rescript-toolkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"clean": "rescript clean",
|
|
6
6
|
"build": "rescript build",
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"reschema": "1.3.1",
|
|
66
66
|
"rescript": "9.1.4",
|
|
67
67
|
"rescript-classnames": "6.0.0",
|
|
68
|
-
"rescript-logger": "2.0.2",
|
|
69
68
|
"rescript-react-update": "5.0.0",
|
|
70
69
|
"restorative": "0.4.0-beta.1",
|
|
71
70
|
"sanitize-html": "2.6.1",
|
|
@@ -74,6 +73,7 @@
|
|
|
74
73
|
},
|
|
75
74
|
"devDependencies": {
|
|
76
75
|
"@babel/core": "7.16.5",
|
|
76
|
+
"@sentry/browser": "6.17.6",
|
|
77
77
|
"@storybook/addon-actions": "6.1.21",
|
|
78
78
|
"@storybook/addon-essentials": "6.1.21",
|
|
79
79
|
"@storybook/addon-knobs": "6.1.21",
|
package/src/Toolkit.res
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
open BsSentry
|
|
2
|
+
|
|
3
|
+
type t
|
|
4
|
+
@val external windowInstance: option<t> = "window"
|
|
5
|
+
@val external window: t = "window"
|
|
6
|
+
@val external process: t = "import.meta.env"
|
|
7
|
+
let get = () => Js.typeof(windowInstance) !== "undefined" ? window : process
|
|
8
|
+
let instance = get()
|
|
9
|
+
|
|
10
|
+
@get external _nodeEnv: t => string = "NODE_ENV"
|
|
11
|
+
|
|
12
|
+
let nodeEnv = instance->_nodeEnv
|
|
13
|
+
|
|
14
|
+
let debugStyle = "background-color: #208E9C; color: white; padding: 5px; font-size: 10px;"
|
|
15
|
+
let warningStyle = "background-color: #FFAD2D; color: white; padding: 5px; font-size: 10px;"
|
|
16
|
+
let errorStyle = "background-color: #FF4714; color: white; padding: 5px; font-size: 10px;"
|
|
17
|
+
|
|
18
|
+
let debug = str => {
|
|
19
|
+
if nodeEnv !== "production" {
|
|
20
|
+
Js.Console.log3("%cDEBUG", debugStyle, str)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let debug2 = (str, str2) => {
|
|
25
|
+
if nodeEnv !== "production" {
|
|
26
|
+
Js.Console.log4("%cDEBUG", debugStyle, str, str2)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
let debug3 = (str, str2, str3) => {
|
|
30
|
+
if nodeEnv !== "production" {
|
|
31
|
+
Js.Console.logMany(["%cDEBUG", debugStyle, Obj.magic(str), Obj.magic(str2), Obj.magic(str3)])
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let warning = str => {
|
|
36
|
+
if nodeEnv !== "production" {
|
|
37
|
+
Js.Console.log3("%cWARN", warningStyle, str)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let warning2 = (str, str2) => {
|
|
42
|
+
if nodeEnv !== "production" {
|
|
43
|
+
Js.Console.log4("%cWARN", warningStyle, str, str2)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let warning3 = (str, str2, str3) => {
|
|
48
|
+
if nodeEnv !== "production" {
|
|
49
|
+
Js.Console.logMany(["%cWARN", warningStyle, str, str2, str3])
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let error = str => {
|
|
54
|
+
if nodeEnv !== "production" {
|
|
55
|
+
Js.Console.log3("%cERROR", errorStyle, str)
|
|
56
|
+
} else {
|
|
57
|
+
open Sentry
|
|
58
|
+
withScope(_scope => {
|
|
59
|
+
captureMessage(Obj.magic(str))
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let error2 = (str, str2) => {
|
|
65
|
+
if nodeEnv !== "production" {
|
|
66
|
+
Js.Console.log4("%cERROR", errorStyle, str, str2)
|
|
67
|
+
} else {
|
|
68
|
+
open Sentry
|
|
69
|
+
withScope(scope => {
|
|
70
|
+
scope->Scope.setExtra("data", str2)
|
|
71
|
+
captureMessage(Obj.magic(str))
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
open BsSentryReactNative
|
|
2
|
+
|
|
3
|
+
@val @scope("process.env") external nodeEnv: string = "NODE_ENV"
|
|
4
|
+
|
|
5
|
+
let debugStyle = "background-color: #208E9C; color: white; padding: 5px; font-size: 10px;"
|
|
6
|
+
let warningStyle = "background-color: #FFAD2D; color: white; padding: 5px; font-size: 10px;"
|
|
7
|
+
let errorStyle = "background-color: #FF4714; color: white; padding: 5px; font-size: 10px;"
|
|
8
|
+
|
|
9
|
+
let debug = str => {
|
|
10
|
+
if nodeEnv !== "production" {
|
|
11
|
+
Js.Console.log3("%cDEBUG", debugStyle, str)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let debug2 = (str, str2) => {
|
|
16
|
+
if nodeEnv !== "production" {
|
|
17
|
+
Js.Console.log4("%cDEBUG", debugStyle, str, str2)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let warning = str => {
|
|
22
|
+
if nodeEnv !== "production" {
|
|
23
|
+
Js.Console.log3("%cWARN", warningStyle, str)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let warning2 = (str, str2) => {
|
|
28
|
+
if nodeEnv !== "production" {
|
|
29
|
+
Js.Console.log4("%cWARN", warningStyle, str, str2)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let error = str => {
|
|
34
|
+
if nodeEnv !== "production" {
|
|
35
|
+
Js.Console.log3("%cERROR", errorStyle, str)
|
|
36
|
+
} else {
|
|
37
|
+
open Sentry
|
|
38
|
+
withScope(_scope => {
|
|
39
|
+
captureMessage(Obj.magic(str))
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let error2 = (str, str2) => {
|
|
45
|
+
if nodeEnv !== "production" {
|
|
46
|
+
Js.Console.log4("%cERROR", errorStyle, str, str2)
|
|
47
|
+
} else {
|
|
48
|
+
open Sentry
|
|
49
|
+
withScope(scope => {
|
|
50
|
+
scope->Scope.setExtra("data", str2)
|
|
51
|
+
captureMessage(Obj.magic(str))
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Logger
|
|
2
|
+
|
|
3
|
+
Display log only at development and trigger Sentry on error on production.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```reason
|
|
8
|
+
let obj = {
|
|
9
|
+
"test": 1,
|
|
10
|
+
"z": "ee"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
Toolkit.BrowserLogger.debug("test")
|
|
14
|
+
|
|
15
|
+
Toolkit.BrowserLogger.error2("Error", obj)
|
|
16
|
+
```
|
|
@@ -1,205 +1,12 @@
|
|
|
1
|
-
type config
|
|
2
|
-
type headers
|
|
3
|
-
type undecodedData
|
|
4
|
-
type failedResponseData
|
|
5
|
-
|
|
6
|
-
type undecodedResponse = {
|
|
7
|
-
data: undecodedData,
|
|
8
|
-
headers: headers,
|
|
9
|
-
config: config,
|
|
10
|
-
status: int,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
type noResponse = {
|
|
14
|
-
message: string,
|
|
15
|
-
config: config,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type rec failedResponse = {
|
|
19
|
-
message: string,
|
|
20
|
-
config: config,
|
|
21
|
-
response: response,
|
|
22
|
-
}
|
|
23
|
-
and response = {
|
|
24
|
-
data: failedResponseData,
|
|
25
|
-
headers: headers,
|
|
26
|
-
status: int,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
external castToJs: 'a => Js.t<'b> = "%identity"
|
|
30
|
-
external castToFailedResponse: Js.Promise.error => failedResponse = "%identity"
|
|
31
|
-
external castToNoResponse: Js.Promise.error => noResponse = "%identity"
|
|
32
|
-
external castToUndecodedResponse: Js.t<'a> => undecodedResponse = "%identity"
|
|
33
|
-
|
|
34
|
-
type error<'a> = [
|
|
35
|
-
| #noResponse(noResponse)
|
|
36
|
-
| #invalidResponse(failedResponse)
|
|
37
|
-
| #invalidResponseData(undecodedResponse, string)
|
|
38
|
-
| #invalidErrorData
|
|
39
|
-
| #unknown(Js.Promise.error)
|
|
40
|
-
| #custom('a)
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
let toResult = (
|
|
44
|
-
promise,
|
|
45
|
-
~mapError: option<failedResponse => option<result<'data, error<'a>>>>=?,
|
|
46
|
-
~errorDecoder=?,
|
|
47
|
-
mapData: Js.Json.t => result<'data, Decco.decodeError>,
|
|
48
|
-
): Promise.promise<result<'data, error<'error>>> =>
|
|
49
|
-
promise
|
|
50
|
-
->Promise.Js.fromBsPromise
|
|
51
|
-
->Promise.Js.toResult
|
|
52
|
-
->Promise.map(res =>
|
|
53
|
-
switch res {
|
|
54
|
-
| Ok(response) =>
|
|
55
|
-
switch response["data"]->mapData {
|
|
56
|
-
| Ok(_) as ok => ok
|
|
57
|
-
| Error(error) => {
|
|
58
|
-
%log.error(
|
|
59
|
-
"Decoder failure"
|
|
60
|
-
("err", error)
|
|
61
|
-
)
|
|
62
|
-
Error(
|
|
63
|
-
#invalidResponseData(
|
|
64
|
-
response->castToUndecodedResponse,
|
|
65
|
-
"\"" ++ (error.path ++ ("\" " ++ error.message)),
|
|
66
|
-
),
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
| Error(error) =>
|
|
71
|
-
if (error->castToJs)["response"] {
|
|
72
|
-
switch (mapError, errorDecoder) {
|
|
73
|
-
| (_, Some(errorDecoder)) =>
|
|
74
|
-
let error = (error->castToFailedResponse).response.data->Obj.magic->errorDecoder
|
|
75
|
-
|
|
76
|
-
switch error {
|
|
77
|
-
| Ok(err) => Error(#custom(err))
|
|
78
|
-
| Error(_err) =>
|
|
79
|
-
%log.error(
|
|
80
|
-
"errorDecoder"
|
|
81
|
-
("err", _err)
|
|
82
|
-
)
|
|
83
|
-
Error(#invalidErrorData)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
| (Some(mapError), _) =>
|
|
87
|
-
switch error->castToFailedResponse->mapError {
|
|
88
|
-
| None => Error(#invalidResponse(error->castToFailedResponse))
|
|
89
|
-
| Some(result) => result
|
|
90
|
-
}
|
|
91
|
-
| _ => Error(#invalidResponse(error->castToFailedResponse))
|
|
92
|
-
}
|
|
93
|
-
} else if (error->castToJs)["request"] {
|
|
94
|
-
Error(#noResponse(error->castToNoResponse))
|
|
95
|
-
} else {
|
|
96
|
-
Error(#unknown(error))
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
type requestError<'a> = error<'a>
|
|
102
|
-
|
|
103
1
|
module type Config = {
|
|
104
2
|
type argument
|
|
105
3
|
type response
|
|
106
4
|
type error
|
|
107
|
-
let exec: argument => Promise.promise<
|
|
5
|
+
let exec: argument => Promise.promise<
|
|
6
|
+
result<response, Axios.WithResult.customError<error, Js.Json.t>>,
|
|
7
|
+
>
|
|
108
8
|
}
|
|
109
9
|
|
|
110
10
|
module Make = (Config: Config) => {
|
|
111
11
|
include Config
|
|
112
12
|
}
|
|
113
|
-
|
|
114
|
-
/* Http method */
|
|
115
|
-
|
|
116
|
-
let get = (
|
|
117
|
-
request: Axios.Instance.t,
|
|
118
|
-
url: string,
|
|
119
|
-
~mapError: option<failedResponse => option<result<'data, error<'a>>>>=?,
|
|
120
|
-
~errorDecoder=?,
|
|
121
|
-
mapData: Js.Json.t => result<'response, Decco.decodeError>,
|
|
122
|
-
): Promise.promise<result<'response, error<'error>>> =>
|
|
123
|
-
request->Axios.Instance.get(url)->toResult(~mapError?, ~errorDecoder?, mapData)
|
|
124
|
-
|
|
125
|
-
let getc = (
|
|
126
|
-
request: Axios.Instance.t,
|
|
127
|
-
url: string,
|
|
128
|
-
~mapError: option<failedResponse => option<result<'data, error<'a>>>>=?,
|
|
129
|
-
~errorDecoder=?,
|
|
130
|
-
~config,
|
|
131
|
-
mapData: Js.Json.t => result<'response, Decco.decodeError>,
|
|
132
|
-
): Promise.promise<result<'response, error<'error>>> =>
|
|
133
|
-
request->Axios.Instance.getc(url, config)->toResult(~mapError?, ~errorDecoder?, mapData)
|
|
134
|
-
|
|
135
|
-
let post = (
|
|
136
|
-
request: Axios.Instance.t,
|
|
137
|
-
url: string,
|
|
138
|
-
~mapError: option<failedResponse => option<result<'data, error<'a>>>>=?,
|
|
139
|
-
~errorDecoder=?,
|
|
140
|
-
mapData: Js.Json.t => result<'response, Decco.decodeError>,
|
|
141
|
-
): Promise.promise<result<'response, error<'error>>> =>
|
|
142
|
-
request->Axios.Instance.post(url)->toResult(~mapError?, ~errorDecoder?, mapData)
|
|
143
|
-
|
|
144
|
-
let postData = (
|
|
145
|
-
request: Axios.Instance.t,
|
|
146
|
-
url: string,
|
|
147
|
-
~mapError: option<failedResponse => option<result<'data, error<'a>>>>=?,
|
|
148
|
-
~errorDecoder=?,
|
|
149
|
-
~config=?,
|
|
150
|
-
mapData: Js.Json.t => result<'response, Decco.decodeError>,
|
|
151
|
-
body: Js.Json.t,
|
|
152
|
-
): Promise.promise<result<'response, error<'error>>> =>
|
|
153
|
-
switch config {
|
|
154
|
-
| None =>
|
|
155
|
-
request
|
|
156
|
-
->Axios.Instance.postData(url, body->castToJs)
|
|
157
|
-
->toResult(~mapError?, ~errorDecoder?, mapData)
|
|
158
|
-
| Some(c) =>
|
|
159
|
-
request
|
|
160
|
-
->Axios.Instance.postDatac(url, body->castToJs, c)
|
|
161
|
-
->toResult(~mapError?, ~errorDecoder?, mapData)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
let put = (
|
|
165
|
-
request: Axios.Instance.t,
|
|
166
|
-
url: string,
|
|
167
|
-
~mapError: option<failedResponse => option<result<'data, error<'a>>>>=?,
|
|
168
|
-
~errorDecoder=?,
|
|
169
|
-
mapData: Js.Json.t => result<'response, Decco.decodeError>,
|
|
170
|
-
): Promise.promise<result<'response, error<'error>>> =>
|
|
171
|
-
request->Axios.Instance.put(url)->toResult(~mapError?, ~errorDecoder?, mapData)
|
|
172
|
-
|
|
173
|
-
let putData = (
|
|
174
|
-
request: Axios.Instance.t,
|
|
175
|
-
url: string,
|
|
176
|
-
~mapError: option<failedResponse => option<result<'data, error<'a>>>>=?,
|
|
177
|
-
~errorDecoder=?,
|
|
178
|
-
~config=?,
|
|
179
|
-
mapData: Js.Json.t => result<'response, Decco.decodeError>,
|
|
180
|
-
body: Js.Json.t,
|
|
181
|
-
): Promise.promise<result<'response, error<'error>>> =>
|
|
182
|
-
switch config {
|
|
183
|
-
| None =>
|
|
184
|
-
request
|
|
185
|
-
->Axios.Instance.putData(url, body->castToJs)
|
|
186
|
-
->toResult(~mapError?, ~errorDecoder?, mapData)
|
|
187
|
-
| Some(c) =>
|
|
188
|
-
request
|
|
189
|
-
->Axios.Instance.putDatac(url, body->castToJs, c)
|
|
190
|
-
->toResult(~mapError?, ~errorDecoder?, mapData)
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
let delete = (
|
|
194
|
-
request: Axios.Instance.t,
|
|
195
|
-
url: string,
|
|
196
|
-
~mapError: option<failedResponse => option<result<'data, error<'a>>>>=?,
|
|
197
|
-
~errorDecoder=?,
|
|
198
|
-
~config=?,
|
|
199
|
-
mapData: Js.Json.t => result<'response, Decco.decodeError>,
|
|
200
|
-
): Promise.promise<result<'response, error<'error>>> =>
|
|
201
|
-
switch config {
|
|
202
|
-
| None => request->Axios.Instance.delete(url)->toResult(~mapError?, ~errorDecoder?, mapData)
|
|
203
|
-
| Some(c) =>
|
|
204
|
-
request->Axios.Instance.deletec(url, c)->toResult(~mapError?, ~errorDecoder?, mapData)
|
|
205
|
-
}
|
|
@@ -27,7 +27,7 @@ module MakeFeature = (C: Config) => {
|
|
|
27
27
|
type t = config<C.argument>
|
|
28
28
|
|
|
29
29
|
let exec = (var: C.input) =>
|
|
30
|
-
|
|
30
|
+
Axios.get(C.envUrl ++ C.featureName, ())
|
|
31
31
|
->Promise.Js.toResult
|
|
32
32
|
->Promise.flatMapOk(({data}) => {
|
|
33
33
|
Promise.resolved(t_decode(data))
|
|
File without changes
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
module type Config = {
|
|
2
|
-
module Request: Toolkit__Request2.Config
|
|
3
|
-
let key: Request.argument => array<string>
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
module Make = (Config: Config) => {
|
|
7
|
-
let key: Config.Request.argument => array<string> = Config.key
|
|
8
|
-
|
|
9
|
-
let use = (
|
|
10
|
-
~options: option<Swr.fetcherOptions>=?,
|
|
11
|
-
key: option<Config.Request.argument>,
|
|
12
|
-
): Toolkit__Hooks.fetcher<Config.Request.response> =>
|
|
13
|
-
Toolkit__Hooks.useFetcher(~options?, key->Option.map(Config.key), () => {
|
|
14
|
-
let key = key->Option.getExn
|
|
15
|
-
|
|
16
|
-
Config.Request.exec(key)->Promise.Js.fromResult
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
let useOptional = (
|
|
20
|
-
~options: option<Swr.fetcherOptions>=?,
|
|
21
|
-
key: option<Config.Request.argument>,
|
|
22
|
-
): Toolkit__Hooks.fetcher<option<Config.Request.response>> =>
|
|
23
|
-
Toolkit__Hooks.useOptionalFetcher(~options?, key->Option.map(Config.key), () => {
|
|
24
|
-
let key = key->Option.getExn
|
|
25
|
-
|
|
26
|
-
Config.Request.exec(key)->Promise.Js.fromResult
|
|
27
|
-
})
|
|
28
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
open BsSentry
|
|
2
|
-
|
|
3
|
-
let error = (loc: ReScriptLogger.Location.t, event) => {
|
|
4
|
-
open Sentry
|
|
5
|
-
withScope(scope => {
|
|
6
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
7
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
8
|
-
scope->Scope.setExtra("function", loc.value)
|
|
9
|
-
captureMessage(event)
|
|
10
|
-
})
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let error1 = (loc: ReScriptLogger.Location.t, event, (label, data)) => {
|
|
14
|
-
open Sentry
|
|
15
|
-
withScope(scope => {
|
|
16
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
17
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
18
|
-
scope->Scope.setExtra("function", loc.value)
|
|
19
|
-
scope->Scope.setExtra(label, data)
|
|
20
|
-
captureMessage(event)
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let error2 = (loc: ReScriptLogger.Location.t, event, (label1, data1), (label2, data2)) => {
|
|
25
|
-
open Sentry
|
|
26
|
-
withScope(scope => {
|
|
27
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
28
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
29
|
-
scope->Scope.setExtra("function", loc.value)
|
|
30
|
-
scope->Scope.setExtra(label1, data1)
|
|
31
|
-
scope->Scope.setExtra(label2, data2)
|
|
32
|
-
captureMessage(event)
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let error3 = (
|
|
37
|
-
loc: ReScriptLogger.Location.t,
|
|
38
|
-
event,
|
|
39
|
-
(label1, data1),
|
|
40
|
-
(label2, data2),
|
|
41
|
-
(label3, data3),
|
|
42
|
-
) => {
|
|
43
|
-
open Sentry
|
|
44
|
-
withScope(scope => {
|
|
45
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
46
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
47
|
-
scope->Scope.setExtra("function", loc.value)
|
|
48
|
-
scope->Scope.setExtra(label1, data1)
|
|
49
|
-
scope->Scope.setExtra(label2, data2)
|
|
50
|
-
scope->Scope.setExtra(label3, data3)
|
|
51
|
-
captureMessage(event)
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
let error4 = (
|
|
55
|
-
loc: ReScriptLogger.Location.t,
|
|
56
|
-
event,
|
|
57
|
-
(label1, data1),
|
|
58
|
-
(label2, data2),
|
|
59
|
-
(label3, data3),
|
|
60
|
-
(label4, data4),
|
|
61
|
-
) => {
|
|
62
|
-
open Sentry
|
|
63
|
-
withScope(scope => {
|
|
64
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
65
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
66
|
-
scope->Scope.setExtra("function", loc.value)
|
|
67
|
-
scope->Scope.setExtra(label1, data1)
|
|
68
|
-
scope->Scope.setExtra(label2, data2)
|
|
69
|
-
scope->Scope.setExtra(label3, data3)
|
|
70
|
-
scope->Scope.setExtra(label4, data4)
|
|
71
|
-
captureMessage(event)
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
let error5 = (
|
|
75
|
-
loc: ReScriptLogger.Location.t,
|
|
76
|
-
event,
|
|
77
|
-
(label1, data1),
|
|
78
|
-
(label2, data2),
|
|
79
|
-
(label3, data3),
|
|
80
|
-
(label4, data4),
|
|
81
|
-
(label5, data5),
|
|
82
|
-
) => {
|
|
83
|
-
open Sentry
|
|
84
|
-
withScope(scope => {
|
|
85
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
86
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
87
|
-
scope->Scope.setExtra("function", loc.value)
|
|
88
|
-
scope->Scope.setExtra(label1, data1)
|
|
89
|
-
scope->Scope.setExtra(label2, data2)
|
|
90
|
-
scope->Scope.setExtra(label3, data3)
|
|
91
|
-
scope->Scope.setExtra(label4, data4)
|
|
92
|
-
scope->Scope.setExtra(label5, data5)
|
|
93
|
-
captureMessage(event)
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
let errorWithData = (loc: ReScriptLogger.Location.t, event, (label, data)) => {
|
|
98
|
-
open Sentry
|
|
99
|
-
withScope(scope => {
|
|
100
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
101
|
-
scope->Scope.setExtra(label, data)
|
|
102
|
-
captureMessage(event)
|
|
103
|
-
})
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
let errorWithData2 = (loc: ReScriptLogger.Location.t, event, (label1, data1), (label2, data2)) => {
|
|
107
|
-
open Sentry
|
|
108
|
-
withScope(scope => {
|
|
109
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
110
|
-
scope->Scope.setExtra(label1, data1)
|
|
111
|
-
scope->Scope.setExtra(label2, data2)
|
|
112
|
-
captureMessage(event)
|
|
113
|
-
})
|
|
114
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
open BsSentryReactNative
|
|
2
|
-
|
|
3
|
-
let error = (loc: ReScriptLogger.Location.t, event) => {
|
|
4
|
-
open Sentry
|
|
5
|
-
withScope(scope => {
|
|
6
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
7
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
8
|
-
scope->Scope.setExtra("function", loc.value)
|
|
9
|
-
captureMessage(event)
|
|
10
|
-
})
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let error1 = (loc: ReScriptLogger.Location.t, event, (label, data)) => {
|
|
14
|
-
open Sentry
|
|
15
|
-
withScope(scope => {
|
|
16
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
17
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
18
|
-
scope->Scope.setExtra("function", loc.value)
|
|
19
|
-
scope->Scope.setExtra(label, data)
|
|
20
|
-
captureMessage(event)
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let error2 = (loc: ReScriptLogger.Location.t, event, (label1, data1), (label2, data2)) => {
|
|
25
|
-
open Sentry
|
|
26
|
-
withScope(scope => {
|
|
27
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
28
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
29
|
-
scope->Scope.setExtra("function", loc.value)
|
|
30
|
-
scope->Scope.setExtra(label1, data1)
|
|
31
|
-
scope->Scope.setExtra(label2, data2)
|
|
32
|
-
captureMessage(event)
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let error3 = (
|
|
37
|
-
loc: ReScriptLogger.Location.t,
|
|
38
|
-
event,
|
|
39
|
-
(label1, data1),
|
|
40
|
-
(label2, data2),
|
|
41
|
-
(label3, data3),
|
|
42
|
-
) => {
|
|
43
|
-
open Sentry
|
|
44
|
-
withScope(scope => {
|
|
45
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
46
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
47
|
-
scope->Scope.setExtra("function", loc.value)
|
|
48
|
-
scope->Scope.setExtra(label1, data1)
|
|
49
|
-
scope->Scope.setExtra(label2, data2)
|
|
50
|
-
scope->Scope.setExtra(label3, data3)
|
|
51
|
-
captureMessage(event)
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
let error4 = (
|
|
55
|
-
loc: ReScriptLogger.Location.t,
|
|
56
|
-
event,
|
|
57
|
-
(label1, data1),
|
|
58
|
-
(label2, data2),
|
|
59
|
-
(label3, data3),
|
|
60
|
-
(label4, data4),
|
|
61
|
-
) => {
|
|
62
|
-
open Sentry
|
|
63
|
-
withScope(scope => {
|
|
64
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
65
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
66
|
-
scope->Scope.setExtra("function", loc.value)
|
|
67
|
-
scope->Scope.setExtra(label1, data1)
|
|
68
|
-
scope->Scope.setExtra(label2, data2)
|
|
69
|
-
scope->Scope.setExtra(label3, data3)
|
|
70
|
-
scope->Scope.setExtra(label4, data4)
|
|
71
|
-
captureMessage(event)
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
let error5 = (
|
|
75
|
-
loc: ReScriptLogger.Location.t,
|
|
76
|
-
event,
|
|
77
|
-
(label1, data1),
|
|
78
|
-
(label2, data2),
|
|
79
|
-
(label3, data3),
|
|
80
|
-
(label4, data4),
|
|
81
|
-
(label5, data5),
|
|
82
|
-
) => {
|
|
83
|
-
open Sentry
|
|
84
|
-
withScope(scope => {
|
|
85
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
86
|
-
scope->Scope.setExtra("fullPath", loc.fullPath)
|
|
87
|
-
scope->Scope.setExtra("function", loc.value)
|
|
88
|
-
scope->Scope.setExtra(label1, data1)
|
|
89
|
-
scope->Scope.setExtra(label2, data2)
|
|
90
|
-
scope->Scope.setExtra(label3, data3)
|
|
91
|
-
scope->Scope.setExtra(label4, data4)
|
|
92
|
-
scope->Scope.setExtra(label5, data5)
|
|
93
|
-
captureMessage(event)
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
let errorWithData = (loc: ReScriptLogger.Location.t, event, (label, data)) => {
|
|
98
|
-
open Sentry
|
|
99
|
-
withScope(scope => {
|
|
100
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
101
|
-
scope->Scope.setExtra(label, data)
|
|
102
|
-
captureMessage(event)
|
|
103
|
-
})
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
let errorWithData2 = (loc: ReScriptLogger.Location.t, event, (label1, data1), (label2, data2)) => {
|
|
107
|
-
open Sentry
|
|
108
|
-
withScope(scope => {
|
|
109
|
-
scope->Scope.setExtra("module", loc.subModulePath->List.toArray)
|
|
110
|
-
scope->Scope.setExtra(label1, data1)
|
|
111
|
-
scope->Scope.setExtra(label2, data2)
|
|
112
|
-
captureMessage(event)
|
|
113
|
-
})
|
|
114
|
-
}
|
package/src/sentry/index.md
DELETED