node-avo-inspector 1.1.1 → 1.2.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.
Files changed (93) hide show
  1. package/.claude/scheduled_tasks.lock +1 -0
  2. package/.claude/settings.local.json +11 -0
  3. package/.claude/worktrees/release-1.1.1/LICENSE +21 -0
  4. package/.claude/worktrees/release-1.1.1/README.md +69 -0
  5. package/.claude/worktrees/release-1.1.1/examples/node-inspector-js/index.js +30 -0
  6. package/.claude/worktrees/release-1.1.1/examples/node-inspector-js/package.json +15 -0
  7. package/.claude/worktrees/release-1.1.1/examples/node-inspector-js/yarn.lock +6 -0
  8. package/.claude/worktrees/release-1.1.1/examples/node-inspector-ts/dist/index.js +34 -0
  9. package/.claude/worktrees/release-1.1.1/examples/node-inspector-ts/index.ts +30 -0
  10. package/.claude/worktrees/release-1.1.1/examples/node-inspector-ts/package.json +18 -0
  11. package/.claude/worktrees/release-1.1.1/examples/node-inspector-ts/tsconfig.json +15 -0
  12. package/.claude/worktrees/release-1.1.1/examples/node-inspector-ts/yarn.lock +11 -0
  13. package/.claude/worktrees/release-1.1.1/package-lock.json +4039 -0
  14. package/.claude/worktrees/release-1.1.1/package.json +48 -0
  15. package/.claude/worktrees/release-1.1.1/reason/AvoInspector.rei +11 -0
  16. package/.claude/worktrees/release-1.1.1/reason/NodeAvoInspector.re +27 -0
  17. package/.claude/worktrees/release-1.1.1/src/AvoDeduplicator.ts +146 -0
  18. package/.claude/worktrees/release-1.1.1/src/AvoEncryption.ts +90 -0
  19. package/.claude/worktrees/release-1.1.1/src/AvoGuid.ts +9 -0
  20. package/.claude/worktrees/release-1.1.1/src/AvoInspector.ts +383 -0
  21. package/.claude/worktrees/release-1.1.1/src/AvoInspectorEnv.ts +8 -0
  22. package/.claude/worktrees/release-1.1.1/src/AvoNetworkCallsHandler.ts +267 -0
  23. package/.claude/worktrees/release-1.1.1/src/AvoSchemaParser.ts +115 -0
  24. package/.claude/worktrees/release-1.1.1/src/AvoStreamId.ts +16 -0
  25. package/.claude/worktrees/release-1.1.1/src/__tests__/TestAvoEncryption.ts +515 -0
  26. package/.claude/worktrees/release-1.1.1/src/__tests__/TestAvoEventSpecCache.ts +242 -0
  27. package/.claude/worktrees/release-1.1.1/src/__tests__/TestAvoEventSpecFetcher.ts +241 -0
  28. package/.claude/worktrees/release-1.1.1/src/__tests__/TestAvoInspector.ts +360 -0
  29. package/.claude/worktrees/release-1.1.1/src/__tests__/TestAvoStreamId.ts +72 -0
  30. package/.claude/worktrees/release-1.1.1/src/__tests__/TestDeduplicator.ts +191 -0
  31. package/.claude/worktrees/release-1.1.1/src/__tests__/TestEventValidator.ts +231 -0
  32. package/.claude/worktrees/release-1.1.1/src/__tests__/TestNetworkCallsHandler.ts +179 -0
  33. package/.claude/worktrees/release-1.1.1/src/__tests__/TestNetworkCallsHandlerPublic.ts +208 -0
  34. package/.claude/worktrees/release-1.1.1/src/__tests__/TestParsing.ts +153 -0
  35. package/.claude/worktrees/release-1.1.1/src/__tests__/constants.ts +63 -0
  36. package/.claude/worktrees/release-1.1.1/src/eventSpec/AvoEventSpecCache.ts +109 -0
  37. package/.claude/worktrees/release-1.1.1/src/eventSpec/AvoEventSpecFetchTypes.ts +47 -0
  38. package/.claude/worktrees/release-1.1.1/src/eventSpec/AvoEventSpecFetcher.ts +106 -0
  39. package/.claude/worktrees/release-1.1.1/src/eventSpec/EventValidator.ts +74 -0
  40. package/.claude/worktrees/release-1.1.1/src/index.ts +2 -0
  41. package/.claude/worktrees/release-1.1.1/src/utils.ts +49 -0
  42. package/.claude/worktrees/release-1.1.1/tsconfig.json +13 -0
  43. package/.claude/worktrees/release-1.1.1/yarn.lock +2310 -0
  44. package/.github/workflows/claude.yml +55 -0
  45. package/dist/AvoDeduplicator.d.ts +4 -3
  46. package/dist/AvoDeduplicator.js +25 -24
  47. package/dist/AvoEncryption.d.ts +26 -0
  48. package/dist/AvoEncryption.js +77 -0
  49. package/dist/AvoInspector.d.ts +34 -3
  50. package/dist/AvoInspector.js +182 -36
  51. package/dist/AvoNetworkCallsHandler.d.ts +39 -13
  52. package/dist/AvoNetworkCallsHandler.js +127 -33
  53. package/dist/AvoStreamId.d.ts +5 -0
  54. package/dist/AvoStreamId.js +15 -0
  55. package/dist/__tests__/TestAvoEncryption.d.ts +1 -0
  56. package/dist/__tests__/TestAvoEncryption.js +288 -0
  57. package/dist/__tests__/TestAvoEventSpecCache.d.ts +1 -0
  58. package/dist/__tests__/TestAvoEventSpecCache.js +194 -0
  59. package/dist/__tests__/TestAvoEventSpecFetcher.d.ts +1 -0
  60. package/dist/__tests__/TestAvoEventSpecFetcher.js +219 -0
  61. package/dist/__tests__/TestAvoInspector.js +76 -2
  62. package/dist/__tests__/TestAvoStreamId.d.ts +1 -0
  63. package/dist/__tests__/TestAvoStreamId.js +55 -0
  64. package/dist/__tests__/TestEventValidator.d.ts +1 -0
  65. package/dist/__tests__/TestEventValidator.js +196 -0
  66. package/dist/__tests__/TestNetworkCallsHandler.js +37 -10
  67. package/dist/__tests__/TestNetworkCallsHandlerPublic.js +74 -41
  68. package/dist/eventSpec/AvoEventSpecCache.d.ts +19 -0
  69. package/dist/eventSpec/AvoEventSpecCache.js +100 -0
  70. package/dist/eventSpec/AvoEventSpecFetchTypes.d.ts +41 -0
  71. package/dist/eventSpec/AvoEventSpecFetchTypes.js +5 -0
  72. package/dist/eventSpec/AvoEventSpecFetcher.d.ts +25 -0
  73. package/dist/eventSpec/AvoEventSpecFetcher.js +159 -0
  74. package/dist/eventSpec/EventValidator.d.ts +15 -0
  75. package/dist/eventSpec/EventValidator.js +53 -0
  76. package/package.json +4 -2
  77. package/src/AvoDeduplicator.ts +31 -27
  78. package/src/AvoEncryption.ts +90 -0
  79. package/src/AvoInspector.ts +275 -49
  80. package/src/AvoNetworkCallsHandler.ts +205 -45
  81. package/src/AvoStreamId.ts +16 -0
  82. package/src/__tests__/TestAvoEncryption.ts +515 -0
  83. package/src/__tests__/TestAvoEventSpecCache.ts +242 -0
  84. package/src/__tests__/TestAvoEventSpecFetcher.ts +279 -0
  85. package/src/__tests__/TestAvoInspector.ts +114 -2
  86. package/src/__tests__/TestAvoStreamId.ts +72 -0
  87. package/src/__tests__/TestEventValidator.ts +231 -0
  88. package/src/__tests__/TestNetworkCallsHandler.ts +82 -15
  89. package/src/__tests__/TestNetworkCallsHandlerPublic.ts +110 -44
  90. package/src/eventSpec/AvoEventSpecCache.ts +119 -0
  91. package/src/eventSpec/AvoEventSpecFetchTypes.ts +47 -0
  92. package/src/eventSpec/AvoEventSpecFetcher.ts +186 -0
  93. package/src/eventSpec/EventValidator.ts +74 -0
@@ -0,0 +1 @@
1
+ {"sessionId":"807772ee-303b-4671-8556-d4549bdcb1c0","pid":8979,"acquiredAt":1774537920892}
@@ -0,0 +1,11 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(grep -n \"propertyType\\\\|propertyName\\\\|encryptedPropertyValue\" /Users/alexverein/code/avo/android-avo-inspector/avoinspector/src/main/java/app/avo/inspector/*.java)",
5
+ "Bash(grep -n \"bodyForEventSchemaCall\\\\|bodyForValidatedEventSchemaCall\\\\|remapProperties\\\\|addEncryptedValues\" /Users/alexverein/code/avo/android-avo-inspector/avoinspector/src/main/java/app/avo/inspector/*.java)",
6
+ "Bash(npm ls:*)",
7
+ "Bash(find /Users/alexverein/code/avo/avo -name CONTRIBUTING* -o -name DEVELOPMENT* -o -name .env.example)",
8
+ "WebSearch"
9
+ ]
10
+ }
11
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Avo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,69 @@
1
+ # Avo Inspector SDK for Node.js
2
+
3
+ [![npm version](https://badge.fury.io/js/node-avo-inspector.svg)](https://badge.fury.io/js/node-avo-inspector)
4
+
5
+ This is a quick start guide. For more information about the Inspector project please read the [Inspector SDK Reference](https://www.avo.app/docs/implementation/avo-inspector-sdk-reference) and the [Inspector Setup Guide](https://www.avo.app/docs/implementation/setup-inspector-sdk).
6
+
7
+ # Installation
8
+
9
+ The library is distributed with npm, install with npm:
10
+ ```
11
+ npm i node-avo-inspector
12
+ ```
13
+
14
+ or yarn:
15
+ ```
16
+ yarn add node-avo-inspector
17
+ ```
18
+
19
+ # Initialization
20
+
21
+ Obtain the API key from the Inspector tab (Inspector > Manage Sources) in your [Avo workspace](https://www.avo.app/welcome)
22
+
23
+ ```javascript
24
+ import * as Inspector from "node-avo-inspector";
25
+
26
+ let inspector = new Inspector.AvoInspector({
27
+ apiKey: "your api key",
28
+ env: Inspector.AvoInspectorEnv.Dev,
29
+ version: "1.0.0",
30
+ appName: "My app",
31
+ });
32
+ ```
33
+
34
+ # Integrating with Avo Codegen
35
+
36
+ The setup is lightweight and is covered [in this guide](https://www.avo.app/docs/implementation/start-using-inspector-with-avo-functions).
37
+
38
+ Every event sent with your Codegen after this integration will automatically be sent to Inspector.
39
+
40
+ # Sending event schemas for events reported outside of Codegen
41
+
42
+ Whenever you send tracking event call the following methods:
43
+
44
+ Read more in the [Avo documentation](https://www.avo.app/docs/implementation/devs-101#inspecting-events)
45
+
46
+ This method gets actual tracking event parameters, extracts schema automatically and sends it to the Inspector backend.
47
+ It is the easiest way to use the library, just call this method at the same place you call your analytics tools' track methods with the same parameters.
48
+
49
+ ```javascript
50
+ inspector.trackSchemaFromEvent("Event name", {
51
+ "String Prop": "Prop Value",
52
+ "Float Prop": 1.0,
53
+ "Boolean Prop": true,
54
+ });
55
+ ```
56
+
57
+ # Enabling logs
58
+
59
+ Logs are enabled by default in the dev mode and disabled in prod mode. You can enable and disable logs by calling the `enableLogging` method:
60
+
61
+ ```javascript
62
+ inspector.enableLogging(true | false);
63
+ ```
64
+
65
+ ## Author
66
+ Avo (https://www.avo.app), hi@avo.app
67
+
68
+ ## License
69
+ AvoInspector is available under the MIT license.
@@ -0,0 +1,30 @@
1
+ const Inspector = require("node-avo-inspector");
2
+
3
+ const inspector = new Inspector.AvoInspector({
4
+ apiKey: "My Api Key",
5
+ env: Inspector.AvoInspectorEnv.Prod,
6
+ version: "1.0.0",
7
+ appName: "My App"
8
+ });
9
+
10
+ let eventName = "App Launched";
11
+ let eventParams = {
12
+ "userId": "odsbet455d",
13
+ "isAdmin": true,
14
+ "answer": 42,
15
+ "pi": 3.14,
16
+ "void": null,
17
+ "shoppingList": ["Bread", "Butter", "Salt"],
18
+ "birthdayGift": {
19
+ "name": "pool",
20
+ "radius": 7,
21
+ "depth": 2.1
22
+ }
23
+ }
24
+
25
+ inspector.enableLogging(true) // default is true for dev and false for prod
26
+
27
+ inspector.trackSchemaFromEvent(eventName, eventParams).then((eventSchema) => {
28
+ console.log("Event schema sent to Avo Inspector", eventSchema)
29
+ })
30
+
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "node-inspector-js-example",
3
+ "version": "1.0.0",
4
+ "description": "example app for avo inspector on node",
5
+ "main": "index.js",
6
+ "private": true,
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "Avo (https://www.avo.app)",
11
+ "license": "MIT",
12
+ "dependencies": {
13
+ "node-avo-inspector": "file:../../"
14
+ }
15
+ }
@@ -0,0 +1,6 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ "node-avo-inspector@file:../..":
6
+ version "1.0.4-beta.0"
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __importStar = (this && this.__importStar) || function (mod) {
3
+ if (mod && mod.__esModule) return mod;
4
+ var result = {};
5
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
+ result["default"] = mod;
7
+ return result;
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const Inspector = __importStar(require("node-avo-inspector"));
11
+ const inspector = new Inspector.AvoInspector({
12
+ apiKey: "My Api Key",
13
+ env: Inspector.AvoInspectorEnv.Prod,
14
+ version: "1.0.0",
15
+ appName: "My App"
16
+ });
17
+ let eventName = "App Launched";
18
+ let eventParams = {
19
+ "userId": "odsbet455d",
20
+ "isAdmin": true,
21
+ "answer": 42,
22
+ "pi": 3.14,
23
+ "void": null,
24
+ "shoppingList": ["Bread", "Butter", "Salt"],
25
+ "birthdayGift": {
26
+ "name": "pool",
27
+ "radius": 7,
28
+ "depth": 2.1
29
+ }
30
+ };
31
+ inspector.enableLogging(true); // default is true for dev and false for prod
32
+ inspector.trackSchemaFromEvent(eventName, eventParams).then((eventSchema) => {
33
+ console.log("Event schema sent to Avo Inspector", eventSchema);
34
+ });
@@ -0,0 +1,30 @@
1
+ import * as Inspector from "node-avo-inspector";
2
+
3
+ const inspector = new Inspector.AvoInspector({
4
+ apiKey: "My Api Key",
5
+ env: Inspector.AvoInspectorEnv.Prod,
6
+ version: "1.0.0",
7
+ appName: "My App"
8
+ });
9
+
10
+ let eventName = "App Launched";
11
+ let eventParams = {
12
+ "userId": "odsbet455d",
13
+ "isAdmin": true,
14
+ "answer": 42,
15
+ "pi": 3.14,
16
+ "void": null,
17
+ "shoppingList": ["Bread", "Butter", "Salt"],
18
+ "birthdayGift": {
19
+ "name": "pool",
20
+ "radius": 7,
21
+ "depth": 2.1
22
+ }
23
+ }
24
+
25
+ inspector.enableLogging(true) // default is true for dev and false for prod
26
+
27
+ inspector.trackSchemaFromEvent(eventName, eventParams).then((eventSchema) => {
28
+ console.log("Event schema sent to Avo Inspector", eventSchema)
29
+ })
30
+
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "node-inspector-ts-example",
3
+ "version": "1.0.0",
4
+ "description": "example app for avo inspector on node",
5
+ "main": "index.ts",
6
+ "private": true,
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "Avo (https://www.avo.app)",
11
+ "license": "MIT",
12
+ "dependencies": {
13
+ "node-avo-inspector": "file:../../"
14
+ },
15
+ "devDependencies": {
16
+ "typescript": "^4.1.2"
17
+ }
18
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2015",
4
+ "module": "commonjs",
5
+ "lib": [
6
+ "ES6"
7
+ ],
8
+ "outDir": "./dist",
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": true
13
+ }
14
+ }
15
+
@@ -0,0 +1,11 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ "node-avo-inspector@file:../..":
6
+ version "0.1.0"
7
+
8
+ typescript@^4.1.2:
9
+ version "4.1.2"
10
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9"
11
+ integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==