@servicetitan/log-service 28.5.0 → 30.0.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 (58) hide show
  1. package/dist/global-error-handler.d.ts.map +1 -1
  2. package/dist/global-error-handler.js.map +1 -1
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/log-service.d.ts +1 -1
  6. package/dist/log-service.d.ts.map +1 -1
  7. package/dist/log-storage.js +1 -1
  8. package/dist/log-storage.js.map +1 -1
  9. package/dist/log.d.ts +3 -3
  10. package/dist/log.d.ts.map +1 -1
  11. package/dist/log.js +1 -1
  12. package/dist/log.js.map +1 -1
  13. package/package.json +6 -6
  14. package/src/global-error-handler.ts +2 -2
  15. package/src/index.ts +2 -2
  16. package/src/log-service.tsx +1 -1
  17. package/src/log-storage.ts +1 -1
  18. package/src/log.ts +4 -4
  19. package/dist/__tests__/__mocks__/broadcast-channel.d.ts +0 -13
  20. package/dist/__tests__/__mocks__/broadcast-channel.d.ts.map +0 -1
  21. package/dist/__tests__/__mocks__/broadcast-channel.js +0 -79
  22. package/dist/__tests__/__mocks__/broadcast-channel.js.map +0 -1
  23. package/dist/__tests__/__mocks__/index.d.ts +0 -2
  24. package/dist/__tests__/__mocks__/index.d.ts.map +0 -1
  25. package/dist/__tests__/__mocks__/index.js +0 -2
  26. package/dist/__tests__/__mocks__/index.js.map +0 -1
  27. package/dist/__tests__/connection-service.test.d.ts +0 -2
  28. package/dist/__tests__/connection-service.test.d.ts.map +0 -1
  29. package/dist/__tests__/connection-service.test.js +0 -43
  30. package/dist/__tests__/connection-service.test.js.map +0 -1
  31. package/dist/__tests__/global-error-handler.test.d.ts +0 -2
  32. package/dist/__tests__/global-error-handler.test.d.ts.map +0 -1
  33. package/dist/__tests__/global-error-handler.test.js +0 -174
  34. package/dist/__tests__/global-error-handler.test.js.map +0 -1
  35. package/dist/__tests__/log-config-provider.test.d.ts +0 -2
  36. package/dist/__tests__/log-config-provider.test.d.ts.map +0 -1
  37. package/dist/__tests__/log-config-provider.test.js +0 -20
  38. package/dist/__tests__/log-config-provider.test.js.map +0 -1
  39. package/dist/__tests__/log-sender.test.d.ts +0 -2
  40. package/dist/__tests__/log-sender.test.d.ts.map +0 -1
  41. package/dist/__tests__/log-sender.test.js +0 -117
  42. package/dist/__tests__/log-sender.test.js.map +0 -1
  43. package/dist/__tests__/log-service.test.d.ts +0 -2
  44. package/dist/__tests__/log-service.test.d.ts.map +0 -1
  45. package/dist/__tests__/log-service.test.js +0 -49
  46. package/dist/__tests__/log-service.test.js.map +0 -1
  47. package/dist/__tests__/log-storage.test.d.ts +0 -2
  48. package/dist/__tests__/log-storage.test.d.ts.map +0 -1
  49. package/dist/__tests__/log-storage.test.js +0 -139
  50. package/dist/__tests__/log-storage.test.js.map +0 -1
  51. package/dist/__tests__/log.test.d.ts +0 -2
  52. package/dist/__tests__/log.test.d.ts.map +0 -1
  53. package/dist/__tests__/log.test.js +0 -137
  54. package/dist/__tests__/log.test.js.map +0 -1
  55. package/dist/__tests__/serialize-with-metadata.test.d.ts +0 -2
  56. package/dist/__tests__/serialize-with-metadata.test.d.ts.map +0 -1
  57. package/dist/__tests__/serialize-with-metadata.test.js +0 -27
  58. package/dist/__tests__/serialize-with-metadata.test.js.map +0 -1
@@ -1,137 +0,0 @@
1
- import { Log, LogEntryType } from '../log';
2
- import { defaultLogConfig } from '../log-config';
3
- import { LogStorage } from '../log-storage';
4
- import { serializeWithMetadata } from '../serialize-with-metadata';
5
- const SECOND = 1000;
6
- const THROTTLE_INTERVAL = 30 * SECOND;
7
- describe(`[log-service] ${Log.name}`, () => {
8
- const logConfig = { endpoint: '/Log/Foo', storageKey: 'LogStorage_Foo' };
9
- const entry = { category: 'category', code: 'code', message: 'foo' };
10
- let parentLog;
11
- beforeAll(() => jest.useFakeTimers());
12
- beforeEach(() => {
13
- jest.clearAllTimers();
14
- jest.spyOn(console, 'error').mockImplementation(jest.fn());
15
- window.localStorage.clear();
16
- });
17
- const subject = () => {
18
- const logStorage = new LogStorage(logConfig);
19
- const log = new Log(logStorage, parentLog);
20
- jest.spyOn(logStorage, 'store');
21
- return { log, logStorage };
22
- };
23
- test('logs info', () => {
24
- const { log, logStorage } = subject();
25
- log.info(entry);
26
- expect(logStorage.store).toHaveBeenCalledWith(expect.objectContaining({ ...entry, type: LogEntryType.Info }));
27
- });
28
- test('logs warnings', () => {
29
- const { log, logStorage } = subject();
30
- log.warning(entry);
31
- expect(logStorage.store).toHaveBeenCalledWith(expect.objectContaining({ ...entry, type: LogEntryType.Warning }));
32
- });
33
- test('log errors, after delay', () => {
34
- const errorEntry = { ...entry, error: new Error('Oops!'), message: undefined };
35
- const { log, logStorage } = subject();
36
- log.error(errorEntry);
37
- jest.runOnlyPendingTimers();
38
- expect(logStorage.store).toHaveBeenCalledWith(expect.objectContaining({
39
- ...errorEntry,
40
- type: LogEntryType.Error,
41
- message: errorEntry.error.message,
42
- }));
43
- // eslint-disable-next-line no-console
44
- expect(console.error).toHaveBeenCalledWith('@log-service/error', errorEntry);
45
- });
46
- test(`skips redundant error logged within ${THROTTLE_INTERVAL / SECOND}s`, () => {
47
- const errorEntry = { ...entry, error: new Error('Oops!') };
48
- const { log, logStorage } = subject();
49
- Array.from({ length: 5 }).forEach(() => log.error(errorEntry));
50
- jest.advanceTimersByTime(THROTTLE_INTERVAL);
51
- expect(logStorage.store).toHaveBeenCalledTimes(1);
52
- });
53
- test(`keeps redundant error logged after ${THROTTLE_INTERVAL / SECOND}s`, () => {
54
- const errorEntry = { ...entry, error: new Error('Oops!') };
55
- const { log, logStorage } = subject();
56
- Array.from({ length: 5 }).forEach(() => log.error(errorEntry));
57
- jest.advanceTimersByTime(THROTTLE_INTERVAL);
58
- Array.from({ length: 5 }).forEach(() => log.error(errorEntry));
59
- jest.runOnlyPendingTimers();
60
- expect(logStorage.store).toHaveBeenCalledTimes(2);
61
- });
62
- test('serializes non-standard errors', () => {
63
- const errorEntry = { ...entry, error: { foo: 'bar' } };
64
- const { log, logStorage } = subject();
65
- log.error(errorEntry);
66
- jest.runOnlyPendingTimers();
67
- expect(logStorage.store).toHaveBeenCalledWith(expect.objectContaining({
68
- message: errorEntry.message,
69
- error: expect.objectContaining({
70
- message: serializeWithMetadata(errorEntry.error),
71
- }),
72
- }));
73
- });
74
- test('extends log data', () => {
75
- const data = { foo: 'bar' };
76
- const { log, logStorage } = subject();
77
- log.info({ ...entry, data });
78
- expect(logStorage.store).toHaveBeenCalledWith(expect.objectContaining({
79
- data: {
80
- ...data,
81
- CreatedOn: new Date(),
82
- Online: window.navigator.onLine,
83
- Url: window.location.toString(),
84
- UserAgent: window.navigator.userAgent,
85
- Source: 'Frontend',
86
- Plugins: '',
87
- TzOffset: expect.any(Number),
88
- IsDst: expect.any(Boolean),
89
- IsDstSubject: expect.any(Boolean),
90
- },
91
- }));
92
- });
93
- describe('when browser has plugins', () => {
94
- const plugins = [
95
- { name: 'foo', filename: 'filename', description: 'description' },
96
- { name: 'bar', filename: 'filename', description: 'description' },
97
- ];
98
- beforeEach(() => {
99
- Object.defineProperty(window.navigator, 'plugins', { value: plugins, writable: true });
100
- });
101
- test('adds plugins to log data', () => {
102
- const { log, logStorage } = subject();
103
- log.info(entry);
104
- expect(logStorage.store).toHaveBeenCalledWith(expect.objectContaining({
105
- data: expect.objectContaining({
106
- Plugins: plugins.map(p => [p.name, p.filename, p.description]).join('/'),
107
- }),
108
- }));
109
- });
110
- describe('when error occurs reading plugins', () => {
111
- beforeEach(() => Object.assign(window.navigator, { plugins: [undefined] }));
112
- test('reports "unknown"', () => {
113
- const { log, logStorage } = subject();
114
- log.info(entry);
115
- expect(logStorage.store).toHaveBeenCalledWith(expect.objectContaining({
116
- data: expect.objectContaining({ Plugins: 'unknown' }),
117
- }));
118
- });
119
- });
120
- });
121
- describe('when log has parent', () => {
122
- beforeEach(() => (parentLog = new Log(new LogStorage(defaultLogConfig))));
123
- test.each(['info', 'warning', 'error'])('forwards %s to parent log', method => {
124
- jest.spyOn(parentLog, method);
125
- const logEntry = { ...entry, error: new Error('Oops!') };
126
- subject().log[method](logEntry);
127
- expect(parentLog[method]).toHaveBeenCalledWith(logEntry);
128
- });
129
- describe.each(['endpoint', 'storageKey'])('when log uses default %s', key => {
130
- beforeEach(() => (logConfig[key] = defaultLogConfig[key]));
131
- test('throws error', () => {
132
- expect(() => subject()).toThrow(/cannot use default configuration/);
133
- });
134
- });
135
- });
136
- });
137
- //# sourceMappingURL=log.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"log.test.js","sourceRoot":"","sources":["../../src/__tests__/log.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAuB,YAAY,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,MAAM,GAAG,IAAI,CAAC;AACpB,MAAM,iBAAiB,GAAG,EAAE,GAAG,MAAM,CAAC;AAEtC,QAAQ,CAAC,iBAAiB,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE;IACvC,MAAM,SAAS,GAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC;IACpF,MAAM,KAAK,GAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC/E,IAAI,SAAc,CAAC;IAEnB,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IAEtC,UAAU,CAAC,GAAG,EAAE;QACZ,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,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GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,GAAG,CAAC,IAAI,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1E,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAkB,CAAC,CACpD,2BAA2B,EAC3B,MAAM,CAAC,EAAE;YACL,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YAE9B,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YACzD,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;YAEhC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,CACJ,CAAC;QAEF,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,CAAwB,CAAC,CAC5D,0BAA0B,EAC1B,GAAG,CAAC,EAAE;YACF,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAE3D,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;gBACtB,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;YACxE,CAAC,CAAC,CAAC;QACP,CAAC,CACJ,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=serialize-with-metadata.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialize-with-metadata.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/serialize-with-metadata.test.ts"],"names":[],"mappings":""}
@@ -1,27 +0,0 @@
1
- import { serializeWithMetadata } from '../serialize-with-metadata';
2
- class Abc {
3
- constructor() {
4
- Object.defineProperty(this, "a", {
5
- enumerable: true,
6
- configurable: true,
7
- writable: true,
8
- value: 1
9
- });
10
- }
11
- }
12
- const cyclicObject = { a: { b: {} } };
13
- cyclicObject.a.b = cyclicObject;
14
- test.each([
15
- [new Error('Error')],
16
- [new Abc()],
17
- [{ b: 1 }],
18
- [null],
19
- [undefined],
20
- [function abc() { }],
21
- [123],
22
- [new Event('MyEvent')],
23
- [cyclicObject],
24
- ])('Serialize with metadata %#', error => {
25
- expect(serializeWithMetadata(error)).toMatchSnapshot();
26
- });
27
- //# sourceMappingURL=serialize-with-metadata.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialize-with-metadata.test.js","sourceRoot":"","sources":["../../src/__tests__/serialize-with-metadata.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,GAAG;IAAT;QACI;;;;mBAAI,CAAC;WAAC;IACV,CAAC;CAAA;AAED,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;AACtC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC;AAEhC,IAAI,CAAC,IAAI,CAAC;IACN,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC,IAAI,GAAG,EAAE,CAAC;IACX,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACV,CAAC,IAAI,CAAC;IACN,CAAC,SAAS,CAAC;IACX,CAAC,SAAS,GAAG,KAAI,CAAC,CAAC;IACnB,CAAC,GAAG,CAAC;IACL,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IACtB,CAAC,YAAY,CAAC;CACjB,CAAC,CAAC,4BAA4B,EAAE,KAAK,CAAC,EAAE;IACrC,MAAM,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;AAC3D,CAAC,CAAC,CAAC"}