avo-inspector 2.1.0 → 2.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.
- package/.claude/settings.local.json +9 -0
- package/CHANGELOG.md +9 -0
- package/README.md +8 -0
- package/dist/AvoAnonymousId.d.ts +26 -0
- package/dist/AvoInspector.d.ts +0 -2
- package/dist/AvoNetworkCallsHandler.d.ts +2 -1
- package/dist/index.js +1 -1
- package/jest.config.js +23 -0
- package/package.json +1 -21
- package/dist-native/AvoBatcher.d.ts +0 -24
- package/dist-native/AvoBatcher.js +0 -82
- package/dist-native/AvoDeduplicator.d.ts +0 -36
- package/dist-native/AvoDeduplicator.js +0 -142
- package/dist-native/AvoGuid.d.ts +0 -3
- package/dist-native/AvoGuid.js +0 -14
- package/dist-native/AvoInspector.d.ts +0 -52
- package/dist-native/AvoInspector.js +0 -220
- package/dist-native/AvoInspectorEnv.d.ts +0 -7
- package/dist-native/AvoInspectorEnv.js +0 -8
- package/dist-native/AvoInstallationId.d.ts +0 -5
- package/dist-native/AvoInstallationId.js +0 -36
- package/dist-native/AvoNetworkCallsHandler.d.ts +0 -48
- package/dist-native/AvoNetworkCallsHandler.js +0 -142
- package/dist-native/AvoSchemaParser.d.ts +0 -11
- package/dist-native/AvoSchemaParser.js +0 -95
- package/dist-native/AvoSessionTracker.d.ts +0 -15
- package/dist-native/AvoSessionTracker.js +0 -104
- package/dist-native/AvoStorage.d.ts +0 -22
- package/dist-native/AvoStorage.js +0 -336
- package/dist-native/__mocks__/xhr.d.ts +0 -12
- package/dist-native/__mocks__/xhr.js +0 -14
- package/dist-native/__mocks__/xhrError.d.ts +0 -12
- package/dist-native/__mocks__/xhrError.js +0 -14
- package/dist-native/__tests__/AvoInspector.d.ts +0 -1
- package/dist-native/__tests__/AvoInspector.js +0 -207
- package/dist-native/__tests__/Batcher.d.ts +0 -1
- package/dist-native/__tests__/Batcher.js +0 -280
- package/dist-native/__tests__/BatcherPublic.d.ts +0 -1
- package/dist-native/__tests__/BatcherPublic.js +0 -82
- package/dist-native/__tests__/Deduplicator.d.ts +0 -1
- package/dist-native/__tests__/Deduplicator.js +0 -111
- package/dist-native/__tests__/InstallationId.d.ts +0 -1
- package/dist-native/__tests__/InstallationId.js +0 -40
- package/dist-native/__tests__/NetworkCallsHandler.d.ts +0 -1
- package/dist-native/__tests__/NetworkCallsHandler.js +0 -132
- package/dist-native/__tests__/Parsing.d.ts +0 -1
- package/dist-native/__tests__/Parsing.js +0 -115
- package/dist-native/__tests__/Sessions.d.ts +0 -1
- package/dist-native/__tests__/Sessions.js +0 -179
- package/dist-native/__tests__/Storage.d.ts +0 -1
- package/dist-native/__tests__/Storage.js +0 -173
- package/dist-native/__tests__/constants.d.ts +0 -36
- package/dist-native/__tests__/constants.js +0 -47
- package/dist-native/index.d.ts +0 -2
- package/dist-native/index.js +0 -7
- package/dist-native/utils.d.ts +0 -3
- package/dist-native/utils.js +0 -42
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
var AvoStorage_1 = require("../AvoStorage");
|
|
51
|
-
var constants_1 = require("../__tests__/constants");
|
|
52
|
-
var originalWindow = __assign({}, window);
|
|
53
|
-
beforeEach(function () {
|
|
54
|
-
window = originalWindow;
|
|
55
|
-
});
|
|
56
|
-
describe("Avo Storage", function () {
|
|
57
|
-
var storage = new AvoStorage_1.AvoStorage(constants_1.defaultOptions.shouldLog);
|
|
58
|
-
var key = "avoKey";
|
|
59
|
-
var value = "avoValue";
|
|
60
|
-
test("Sets and gets item with shouldLog on", function () {
|
|
61
|
-
var storage = new AvoStorage_1.AvoStorage(true);
|
|
62
|
-
storage.setItem(key, value);
|
|
63
|
-
var item = storage.getItem(key);
|
|
64
|
-
expect(item).toBe(value);
|
|
65
|
-
});
|
|
66
|
-
test("Sets and gets item with shouldLog off", function () {
|
|
67
|
-
var storage = new AvoStorage_1.AvoStorage(false);
|
|
68
|
-
storage.setItem(key, value);
|
|
69
|
-
var item = storage.getItem(key);
|
|
70
|
-
expect(item).toBe(value);
|
|
71
|
-
});
|
|
72
|
-
test("Gets item asynchronously", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
-
var item;
|
|
74
|
-
return __generator(this, function (_a) {
|
|
75
|
-
switch (_a.label) {
|
|
76
|
-
case 0:
|
|
77
|
-
storage.removeItem(key);
|
|
78
|
-
storage.setItem(key, value);
|
|
79
|
-
return [4 /*yield*/, storage.getItemAsync(key)];
|
|
80
|
-
case 1:
|
|
81
|
-
item = _a.sent();
|
|
82
|
-
expect(item).toBe(value);
|
|
83
|
-
return [2 /*return*/];
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}); });
|
|
87
|
-
test("Returns null if key does not exist", function () {
|
|
88
|
-
storage.removeItem(key);
|
|
89
|
-
var item = storage.getItem(key);
|
|
90
|
-
expect(item).toBeNull();
|
|
91
|
-
});
|
|
92
|
-
test("Deletes item with shouldLog on", function () {
|
|
93
|
-
var storage = new AvoStorage_1.AvoStorage(true);
|
|
94
|
-
storage.removeItem(key);
|
|
95
|
-
var item = storage.getItem(key);
|
|
96
|
-
expect(item).toBeNull();
|
|
97
|
-
});
|
|
98
|
-
test("Deletes item with shouldLog off", function () {
|
|
99
|
-
var storage = new AvoStorage_1.AvoStorage(false);
|
|
100
|
-
storage.removeItem(key);
|
|
101
|
-
var item = storage.getItem(key);
|
|
102
|
-
expect(item).toBeNull();
|
|
103
|
-
});
|
|
104
|
-
test("storage writes are delayed until the storage is initialized on web", function () {
|
|
105
|
-
var storageWebImpl = storage.storageImpl;
|
|
106
|
-
storageWebImpl.storageInitialized = false;
|
|
107
|
-
storage.setItem(key, "OnStorageInitFuncs on web");
|
|
108
|
-
var itemBeforeInit = storage.getItem(key);
|
|
109
|
-
expect(itemBeforeInit).toBeNull();
|
|
110
|
-
storageWebImpl.init(true);
|
|
111
|
-
var itemAfterInit = storage.getItem(key);
|
|
112
|
-
expect(itemAfterInit).toEqual("OnStorageInitFuncs on web");
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
describe("Avo Storage unavailable", function () {
|
|
116
|
-
var key = "avoKey";
|
|
117
|
-
var value = "avoValue";
|
|
118
|
-
beforeEach(function () {
|
|
119
|
-
Object.defineProperty(window, "localStorage", {});
|
|
120
|
-
});
|
|
121
|
-
test("Fallback mode enabled", function () {
|
|
122
|
-
var storage = new AvoStorage_1.AvoStorage(false);
|
|
123
|
-
var storageImpl = storage.storageImpl;
|
|
124
|
-
expect(storageImpl.useFallbackStorage).toBe(true);
|
|
125
|
-
expect(storageImpl.storageInitialized).toBe(true);
|
|
126
|
-
});
|
|
127
|
-
test("Sets and gets item with shouldLog on", function () {
|
|
128
|
-
var storage = new AvoStorage_1.AvoStorage(true);
|
|
129
|
-
storage.setItem(key, value);
|
|
130
|
-
var item = storage.getItem(key);
|
|
131
|
-
expect(item).toBe(value);
|
|
132
|
-
});
|
|
133
|
-
test("Sets and gets item with shouldLog off", function () {
|
|
134
|
-
var storage = new AvoStorage_1.AvoStorage(false);
|
|
135
|
-
storage.setItem(key, value);
|
|
136
|
-
var item = storage.getItem(key);
|
|
137
|
-
expect(item).toBe(value);
|
|
138
|
-
});
|
|
139
|
-
test("Gets item asynchronously", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
140
|
-
var storage, item;
|
|
141
|
-
return __generator(this, function (_a) {
|
|
142
|
-
switch (_a.label) {
|
|
143
|
-
case 0:
|
|
144
|
-
storage = new AvoStorage_1.AvoStorage(false);
|
|
145
|
-
storage.removeItem(key);
|
|
146
|
-
storage.setItem(key, value);
|
|
147
|
-
return [4 /*yield*/, storage.getItemAsync(key)];
|
|
148
|
-
case 1:
|
|
149
|
-
item = _a.sent();
|
|
150
|
-
expect(item).toBe(value);
|
|
151
|
-
return [2 /*return*/];
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}); });
|
|
155
|
-
test("Returns null if key does not exist", function () {
|
|
156
|
-
var storage = new AvoStorage_1.AvoStorage(false);
|
|
157
|
-
storage.removeItem(key);
|
|
158
|
-
var item = storage.getItem(key);
|
|
159
|
-
expect(item).toBeNull();
|
|
160
|
-
});
|
|
161
|
-
test("Deletes item with shouldLog on", function () {
|
|
162
|
-
var storage = new AvoStorage_1.AvoStorage(true);
|
|
163
|
-
storage.removeItem(key);
|
|
164
|
-
var item = storage.getItem(key);
|
|
165
|
-
expect(item).toBeNull();
|
|
166
|
-
});
|
|
167
|
-
test("Deletes item with shouldLog off", function () {
|
|
168
|
-
var storage = new AvoStorage_1.AvoStorage(false);
|
|
169
|
-
storage.removeItem(key);
|
|
170
|
-
var item = storage.getItem(key);
|
|
171
|
-
expect(item).toBeNull();
|
|
172
|
-
});
|
|
173
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
declare const defaultOptions: {
|
|
2
|
-
apiKey: string;
|
|
3
|
-
env: "prod";
|
|
4
|
-
version: string;
|
|
5
|
-
shouldLog: boolean;
|
|
6
|
-
};
|
|
7
|
-
declare const error: {
|
|
8
|
-
API_KEY: string;
|
|
9
|
-
VERSION: string;
|
|
10
|
-
};
|
|
11
|
-
declare const mockedReturns: {
|
|
12
|
-
INSTALLATION_ID: string;
|
|
13
|
-
GUID: string;
|
|
14
|
-
SESSION_ID: string;
|
|
15
|
-
};
|
|
16
|
-
declare const networkCallType: {
|
|
17
|
-
EVENT: string;
|
|
18
|
-
SESSION_STARTED: string;
|
|
19
|
-
};
|
|
20
|
-
declare const requestMsg: {
|
|
21
|
-
ERROR: string;
|
|
22
|
-
TIMEOUT: string;
|
|
23
|
-
};
|
|
24
|
-
declare const trackingEndpoint = "https://api.avo.app/inspector/v1/track";
|
|
25
|
-
declare const sessionTimeMs: number;
|
|
26
|
-
declare const type: {
|
|
27
|
-
STRING: string;
|
|
28
|
-
INT: string;
|
|
29
|
-
OBJECT: string;
|
|
30
|
-
FLOAT: string;
|
|
31
|
-
LIST: string;
|
|
32
|
-
BOOL: string;
|
|
33
|
-
NULL: string;
|
|
34
|
-
UNKNOWN: string;
|
|
35
|
-
};
|
|
36
|
-
export { defaultOptions, error, mockedReturns, networkCallType, requestMsg, sessionTimeMs, type, trackingEndpoint, };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.trackingEndpoint = exports.type = exports.sessionTimeMs = exports.requestMsg = exports.networkCallType = exports.mockedReturns = exports.error = exports.defaultOptions = void 0;
|
|
4
|
-
var AvoInspectorEnv_1 = require("../AvoInspectorEnv");
|
|
5
|
-
var defaultOptions = {
|
|
6
|
-
apiKey: "api-key-xxx",
|
|
7
|
-
env: AvoInspectorEnv_1.AvoInspectorEnv.Prod,
|
|
8
|
-
version: "1",
|
|
9
|
-
shouldLog: true
|
|
10
|
-
};
|
|
11
|
-
exports.defaultOptions = defaultOptions;
|
|
12
|
-
var error = {
|
|
13
|
-
API_KEY: "[Avo Inspector] No API key provided. Inspector can't operate without API key.",
|
|
14
|
-
VERSION: "[Avo Inspector] No version provided. Many features of Inspector rely on versioning. Please provide comparable string version, i.e. integer or semantic.",
|
|
15
|
-
};
|
|
16
|
-
exports.error = error;
|
|
17
|
-
var mockedReturns = {
|
|
18
|
-
INSTALLATION_ID: "avo-instalation-id",
|
|
19
|
-
GUID: "generated-guid",
|
|
20
|
-
SESSION_ID: "session-id",
|
|
21
|
-
};
|
|
22
|
-
exports.mockedReturns = mockedReturns;
|
|
23
|
-
var networkCallType = {
|
|
24
|
-
EVENT: "event",
|
|
25
|
-
SESSION_STARTED: "sessionStarted",
|
|
26
|
-
};
|
|
27
|
-
exports.networkCallType = networkCallType;
|
|
28
|
-
var requestMsg = {
|
|
29
|
-
ERROR: "Request failed",
|
|
30
|
-
TIMEOUT: "Request timed out",
|
|
31
|
-
};
|
|
32
|
-
exports.requestMsg = requestMsg;
|
|
33
|
-
var trackingEndpoint = "https://api.avo.app/inspector/v1/track";
|
|
34
|
-
exports.trackingEndpoint = trackingEndpoint;
|
|
35
|
-
var sessionTimeMs = 5 * 60 * 1000;
|
|
36
|
-
exports.sessionTimeMs = sessionTimeMs;
|
|
37
|
-
var type = {
|
|
38
|
-
STRING: "string",
|
|
39
|
-
INT: "int",
|
|
40
|
-
OBJECT: "object",
|
|
41
|
-
FLOAT: "float",
|
|
42
|
-
LIST: "list",
|
|
43
|
-
BOOL: "boolean",
|
|
44
|
-
NULL: "null",
|
|
45
|
-
UNKNOWN: "unknown",
|
|
46
|
-
};
|
|
47
|
-
exports.type = type;
|
package/dist-native/index.d.ts
DELETED
package/dist-native/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AvoInspectorEnv = exports.AvoInspector = void 0;
|
|
4
|
-
var AvoInspector_1 = require("./AvoInspector");
|
|
5
|
-
Object.defineProperty(exports, "AvoInspector", { enumerable: true, get: function () { return AvoInspector_1.AvoInspector; } });
|
|
6
|
-
var AvoInspectorEnv_1 = require("./AvoInspectorEnv");
|
|
7
|
-
Object.defineProperty(exports, "AvoInspectorEnv", { enumerable: true, get: function () { return AvoInspectorEnv_1.AvoInspectorEnv; } });
|
package/dist-native/utils.d.ts
DELETED
package/dist-native/utils.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deepEquals = exports.isValueEmpty = void 0;
|
|
4
|
-
var isValueEmpty = function (value) {
|
|
5
|
-
return value === null || value === undefined || value.trim().length == 0;
|
|
6
|
-
};
|
|
7
|
-
exports.isValueEmpty = isValueEmpty;
|
|
8
|
-
function deepEquals(x, y) {
|
|
9
|
-
if (x === y) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
if (!(x instanceof Object) || !(y instanceof Object)) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
if (x.constructor !== y.constructor) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
for (var p in x) {
|
|
19
|
-
if (!x.hasOwnProperty(p)) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
if (!y.hasOwnProperty(p)) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
if (x[p] === y[p]) {
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if (typeof x[p] !== "object") {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
if (!deepEquals(x[p], y[p])) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
for (p in y) {
|
|
36
|
-
if (y.hasOwnProperty(p) && !x.hasOwnProperty(p)) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
exports.deepEquals = deepEquals;
|