@colisweb/rescript-toolkit 1.30.0 → 2.1.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/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Datetime = {
|
|
2
2
|
type date = Js.Date.t
|
|
3
3
|
|
|
4
4
|
let encoder: Decco.encoder<date> = value => value->Js.Date.toISOString->Decco.stringToJson
|
|
@@ -15,6 +15,24 @@ module Date = {
|
|
|
15
15
|
type t = @decco.codec(codec) date
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
module Date = {
|
|
19
|
+
type date = Js.Date.t
|
|
20
|
+
|
|
21
|
+
let encoder: Decco.encoder<date> = date =>
|
|
22
|
+
date->BsDateFns.formatWithPattern("yyyy-MM-dd")->Decco.stringToJson
|
|
23
|
+
|
|
24
|
+
let decoder: Decco.decoder<date> = json =>
|
|
25
|
+
switch Decco.stringFromJson(json) {
|
|
26
|
+
| Ok(v) => Js.Date.fromString(v)->Ok
|
|
27
|
+
| Error(_) as err => err
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let codec: Decco.codec<date> = (encoder, decoder)
|
|
31
|
+
|
|
32
|
+
@decco
|
|
33
|
+
type t = @decco.codec(codec) date
|
|
34
|
+
}
|
|
35
|
+
|
|
18
36
|
module Int = {
|
|
19
37
|
let encoder = value => value->Decco.intToJson
|
|
20
38
|
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
}
|
|
@@ -23,6 +23,19 @@ module Footer = {
|
|
|
23
23
|
</footer>
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
module NavOpenContext = {
|
|
27
|
+
let context = React.createContext(false)
|
|
28
|
+
|
|
29
|
+
module Provider = {
|
|
30
|
+
let provider = React.Context.provider(context)
|
|
31
|
+
|
|
32
|
+
@react.component
|
|
33
|
+
let make = (~value, ~children) => {
|
|
34
|
+
React.createElement(provider, {"value": value, "children": children})
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
module App = {
|
|
27
40
|
let localStorageNavKey = "@colisweb/navOpen"
|
|
28
41
|
|
|
@@ -149,19 +162,21 @@ module App = {
|
|
|
149
162
|
|
|
150
163
|
let hideMenu = React.useCallback(_ => setOpen(_ => false))
|
|
151
164
|
|
|
152
|
-
<
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
<
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
className
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
165
|
+
<NavOpenContext.Provider value={isNavOpen}>
|
|
166
|
+
<div>
|
|
167
|
+
<TopNavigationBar username logout logoutLabel toggleMenu onLogoClick />
|
|
168
|
+
<div className="flex">
|
|
169
|
+
<LeftNavigationBar isNavOpen ?bottom hideMenu> sideNavRender </LeftNavigationBar>
|
|
170
|
+
<main
|
|
171
|
+
className={cx([
|
|
172
|
+
className,
|
|
173
|
+
"flex-initial w-full transition-all duration-300 ease-in-out mt-16 z-20",
|
|
174
|
+
isNavOpen ? "navOpen lg:pl-64" : "lg:pl-16",
|
|
175
|
+
])}>
|
|
176
|
+
children
|
|
177
|
+
</main>
|
|
178
|
+
</div>
|
|
164
179
|
</div>
|
|
165
|
-
</
|
|
180
|
+
</NavOpenContext.Provider>
|
|
166
181
|
}
|
|
167
182
|
}
|
|
@@ -2,21 +2,23 @@ module Sentry = {
|
|
|
2
2
|
module Scope = {
|
|
3
3
|
type t
|
|
4
4
|
|
|
5
|
-
@
|
|
5
|
+
@send external setExtra: (t, string, 'a) => unit = "setExtra"
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
@module("
|
|
9
|
-
external init: Js.t<'a> => unit = "init"
|
|
8
|
+
@module("sentry-expo") external init: 'a => unit = "init"
|
|
10
9
|
|
|
11
|
-
@module("
|
|
10
|
+
@module("sentry-expo") @scope("Native")
|
|
12
11
|
external setTag: (string, string) => unit = "setTag"
|
|
13
12
|
|
|
14
|
-
@module("
|
|
13
|
+
@module("sentry-expo") @scope("Native")
|
|
14
|
+
external setUser: 'a => unit = "setUser"
|
|
15
|
+
|
|
16
|
+
@module("sentry-expo") @scope("Native")
|
|
15
17
|
external captureException: Js.Promise.error => unit = "captureException"
|
|
16
18
|
|
|
17
|
-
@module("
|
|
19
|
+
@module("sentry-expo") @scope("Native")
|
|
18
20
|
external captureMessage: string => unit = "captureMessage"
|
|
19
21
|
|
|
20
|
-
@module("
|
|
22
|
+
@module("sentry-expo") @scope("Native")
|
|
21
23
|
external withScope: (Scope.t => unit) => unit = "withScope"
|
|
22
24
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type fallbackProps = {
|
|
2
|
+
error: Js.Exn.t,
|
|
3
|
+
resetErrorBoundary: unit => unit,
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
@module("react-error-boundary") @react.component
|
|
7
|
+
external make: (
|
|
8
|
+
~fallback: React.element=?,
|
|
9
|
+
~fallbackComponent: fallbackProps => React.element=?,
|
|
10
|
+
~fallbackRender: fallbackProps => React.element=?,
|
|
11
|
+
~children: React.element,
|
|
12
|
+
~resetKeys: array<'a>=?,
|
|
13
|
+
) => React.element = "ErrorBoundary"
|