@exodus/analytics-validation 1.3.0 → 1.4.1
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/CHANGELOG.md +12 -0
- package/README.md +59 -6
- package/package.json +2 -2
- package/src/home/home-banner-page-view.schemasafe.json +30 -0
- package/src/main.schemasafe.json +9 -0
- package/src/onboarding/onboarding-existing-wallet-tap.schemasafe.json +29 -0
- package/src/onboarding/onboarding-new-wallet-tap.schemasafe.json +32 -0
- package/src/wallet/wallet-connect-connection-added.schemasafe.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.4.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/analytics-validation@1.4.0...@exodus/analytics-validation@1.4.1) (2023-06-12)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **AnalyticsValidation:** add isAuth for WalletConnectConnectionAdded schema ([#1892](https://github.com/ExodusMovement/exodus-hydra/issues/1892)) ([19177ba](https://github.com/ExodusMovement/exodus-hydra/commit/19177bab24d07ce7553cc13b197b5b4ec8c6619d))
|
|
11
|
+
|
|
12
|
+
## [1.4.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/analytics-validation@1.3.0...@exodus/analytics-validation@1.4.0) (2023-06-09)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **analytics-validation:** add events for new onboarding and home tour ([#1879](https://github.com/ExodusMovement/exodus-hydra/issues/1879)) ([4a9ac31](https://github.com/ExodusMovement/exodus-hydra/commit/4a9ac31191124faa5c4a7a51967cbf4fe85bbc69))
|
|
17
|
+
|
|
6
18
|
## [1.3.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/analytics-validation@1.2.0...@exodus/analytics-validation@1.3.0) (2023-06-05)
|
|
7
19
|
|
|
8
20
|
### Features
|
package/README.md
CHANGED
|
@@ -1,17 +1,70 @@
|
|
|
1
1
|
# @exodus/analytics-validation
|
|
2
2
|
|
|
3
|
+
## Why
|
|
4
|
+
|
|
5
|
+
This helps prevent that we do not accidentally collect any sensitive and/or private information, therefore all events must pass a validation layer.
|
|
6
|
+
|
|
7
|
+
Examples of what could go wrong:
|
|
8
|
+
|
|
9
|
+
- [Slope Finance sending 12-word mnemonics to Sentry 💀](https://twitter.com/osec_io/status/1555087560887922688?s=20)
|
|
10
|
+
|
|
3
11
|
## Development
|
|
4
12
|
|
|
5
|
-
|
|
6
|
-
|
|
13
|
+
### Do I need to add a new schema?
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
flowchart TD
|
|
17
|
+
Title(Adding a new telemetry event) --> A
|
|
18
|
+
A{Does your event\nhave properties?}
|
|
19
|
+
A -->|Yes| C
|
|
20
|
+
A -->|No| B
|
|
21
|
+
B(You're done!)
|
|
22
|
+
C{Does it only require\n the 'origin' property?}
|
|
23
|
+
C -->|Yes| B
|
|
24
|
+
C -->|No| E[Generate a new JSON Schema: \nyarn generate:analytics-validation]
|
|
25
|
+
E --> D[Adjust the schema and tests]
|
|
26
|
+
D --> B
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### JSON Schema Development
|
|
7
31
|
|
|
8
32
|
To add a new schema run
|
|
9
33
|
|
|
10
|
-
|
|
34
|
+
```bash
|
|
35
|
+
yarn generate:analytics-validation
|
|
36
|
+
```
|
|
11
37
|
|
|
12
38
|
in the project root. The CLI tool will ask you for all details needed.
|
|
13
39
|
Once the schema is created, make sure to
|
|
14
40
|
|
|
15
|
-
1.
|
|
16
|
-
2.
|
|
17
|
-
3.
|
|
41
|
+
1. Before adding a new schema, double check if a subdirectory (essentially an event domain, e.g. `dapps`) already exists in `./src`. If not, you will have to come up with a subdirectory name during the next steps;
|
|
42
|
+
2. Fill the schema with the expected properties and their types. The property names must be in the **snake_case** (e.g. `expected_property`);
|
|
43
|
+
3. Fix the generated unit test as it will be intentionally failing;
|
|
44
|
+
4. Add your own test cases to ensure the schema works properly before merging the PR and publishing a new version.
|
|
45
|
+
|
|
46
|
+
#### List of string formats
|
|
47
|
+
|
|
48
|
+
Schemasafe ships with a bunch of default formats, [you can find the implementation of these here!](https://github.com/ExodusMovement/schemasafe/blob/master/src/formats.js)
|
|
49
|
+
|
|
50
|
+
- email
|
|
51
|
+
- hostname
|
|
52
|
+
- uuid
|
|
53
|
+
- date
|
|
54
|
+
- time
|
|
55
|
+
- date-time
|
|
56
|
+
- duration
|
|
57
|
+
- ipv4
|
|
58
|
+
- ipv6
|
|
59
|
+
- uri
|
|
60
|
+
- uri-reference
|
|
61
|
+
- uri-template
|
|
62
|
+
- alpha
|
|
63
|
+
- alphanumeric
|
|
64
|
+
- base64
|
|
65
|
+
- hex-digits
|
|
66
|
+
- hex-digits-prefixed
|
|
67
|
+
- hex-bytes
|
|
68
|
+
- hex-bytes-prefixed
|
|
69
|
+
- json-pointer
|
|
70
|
+
- relative-json-pointer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/analytics-validation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "The analytics-validation library",
|
|
5
5
|
"author": "Exodus Movement Inc",
|
|
6
6
|
"repository": {
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"eslint": "^8.33.0",
|
|
34
34
|
"jest": "^29.1.2"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "b37b53c1f4f795017ab77444574df2305b2579eb"
|
|
37
37
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"event": {
|
|
6
|
+
"const": "HomeBannerPageView"
|
|
7
|
+
},
|
|
8
|
+
"properties": {
|
|
9
|
+
"allOf": [
|
|
10
|
+
{
|
|
11
|
+
"$ref": "common-properties#"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": [],
|
|
16
|
+
"properties": {
|
|
17
|
+
"page_order": {
|
|
18
|
+
"type": "number"
|
|
19
|
+
},
|
|
20
|
+
"page": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"format": "any-string"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"unevaluatedProperties": false
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"unevaluatedProperties": false,
|
|
29
|
+
"required": ["event", "properties"]
|
|
30
|
+
}
|
package/src/main.schemasafe.json
CHANGED
|
@@ -96,6 +96,9 @@
|
|
|
96
96
|
{
|
|
97
97
|
"$ref": "fusion-profile-update#"
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
"$ref": "home-banner-page-view#"
|
|
101
|
+
},
|
|
99
102
|
{
|
|
100
103
|
"$ref": "home-edit-favorites-toggle#"
|
|
101
104
|
},
|
|
@@ -186,6 +189,12 @@
|
|
|
186
189
|
{
|
|
187
190
|
"$ref": "on-ramp-purchase-confirm#"
|
|
188
191
|
},
|
|
192
|
+
{
|
|
193
|
+
"$ref": "onboarding-existing-wallet-tap#"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"$ref": "onboarding-new-wallet-tap#"
|
|
197
|
+
},
|
|
189
198
|
{
|
|
190
199
|
"$ref": "onboarding-page-skipped#"
|
|
191
200
|
},
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"event": {
|
|
6
|
+
"const": "OnboardingExistingWalletTap"
|
|
7
|
+
},
|
|
8
|
+
"properties": {
|
|
9
|
+
"allOf": [
|
|
10
|
+
{
|
|
11
|
+
"$ref": "common-properties#"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": [],
|
|
16
|
+
"properties": {
|
|
17
|
+
"invite_code": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"format": "any-string",
|
|
20
|
+
"minLength": 1,
|
|
21
|
+
"maxLength": 10
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"unevaluatedProperties": false
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"unevaluatedProperties": false,
|
|
28
|
+
"required": ["event", "properties"]
|
|
29
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"event": {
|
|
6
|
+
"const": "OnboardingNewWalletTap"
|
|
7
|
+
},
|
|
8
|
+
"properties": {
|
|
9
|
+
"allOf": [
|
|
10
|
+
{
|
|
11
|
+
"$ref": "common-properties#"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": [],
|
|
16
|
+
"properties": {
|
|
17
|
+
"has_invite_code": {
|
|
18
|
+
"type": "boolean"
|
|
19
|
+
},
|
|
20
|
+
"invite_code": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"format": "any-string",
|
|
23
|
+
"minLength": 1,
|
|
24
|
+
"maxLength": 10
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"unevaluatedProperties": false
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"unevaluatedProperties": false,
|
|
31
|
+
"required": ["event", "properties"]
|
|
32
|
+
}
|