@lark-sentry/utils 1.0.0 → 1.0.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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { EventType, BreadcrumbType, IBaseData, TUnknownError, IExtendedErrorEvent, IPerformanceData, ISentry, IOptions, IDeviceInfo, IHttpData } from '@lark-sentry/types';
1
+ import { EventType, BreadcrumbType, IReportPayload, TUnknownError, IExtendedErrorEvent, IPerformanceData, ISentry, IOptions, IDeviceInfo, IHttpData } from '@lark-sentry/types';
2
2
  import { Metric } from 'web-vitals';
3
3
 
4
4
  declare function base64(raw: string): string;
@@ -39,7 +39,7 @@ declare function event2breadcrumb(type: EventType): BreadcrumbType;
39
39
 
40
40
  declare function getCssSelectors(elem: Element): [idSelector: string, classAttrSelector: string, elemSelector: string];
41
41
 
42
- declare function getTime(): Pick<IBaseData, "time" | "timestamp">;
42
+ declare function getBaseData(): IReportPayload;
43
43
 
44
44
  declare function isExcludedApi(api: string): boolean;
45
45
 
@@ -73,4 +73,4 @@ declare function throttleV2<T extends (...args: any[]) => any>(fn: T, delay?: nu
73
73
 
74
74
  declare function transformHttpData(data: IHttpData): IHttpData;
75
75
 
76
- export { CallbackQueue, MinHeap, base64, base64v2, debounce, decorateProp, dom2str, event2breadcrumb, getCssSelectors, getTime, isError, isErrorEvent, isExcludedApi, isHTMLElement, isIExtendedErrorEvent, metric2perfData, _default as sentry, throttle, throttleV2, transformHttpData };
76
+ export { CallbackQueue, MinHeap, base64, base64v2, debounce, decorateProp, dom2str, event2breadcrumb, getBaseData, getCssSelectors, isError, isErrorEvent, isExcludedApi, isHTMLElement, isIExtendedErrorEvent, metric2perfData, _default as sentry, throttle, throttleV2, transformHttpData };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { EventType, BreadcrumbType, IBaseData, TUnknownError, IExtendedErrorEvent, IPerformanceData, ISentry, IOptions, IDeviceInfo, IHttpData } from '@lark-sentry/types';
1
+ import { EventType, BreadcrumbType, IReportPayload, TUnknownError, IExtendedErrorEvent, IPerformanceData, ISentry, IOptions, IDeviceInfo, IHttpData } from '@lark-sentry/types';
2
2
  import { Metric } from 'web-vitals';
3
3
 
4
4
  declare function base64(raw: string): string;
@@ -39,7 +39,7 @@ declare function event2breadcrumb(type: EventType): BreadcrumbType;
39
39
 
40
40
  declare function getCssSelectors(elem: Element): [idSelector: string, classAttrSelector: string, elemSelector: string];
41
41
 
42
- declare function getTime(): Pick<IBaseData, "time" | "timestamp">;
42
+ declare function getBaseData(): IReportPayload;
43
43
 
44
44
  declare function isExcludedApi(api: string): boolean;
45
45
 
@@ -73,4 +73,4 @@ declare function throttleV2<T extends (...args: any[]) => any>(fn: T, delay?: nu
73
73
 
74
74
  declare function transformHttpData(data: IHttpData): IHttpData;
75
75
 
76
- export { CallbackQueue, MinHeap, base64, base64v2, debounce, decorateProp, dom2str, event2breadcrumb, getCssSelectors, getTime, isError, isErrorEvent, isExcludedApi, isHTMLElement, isIExtendedErrorEvent, metric2perfData, _default as sentry, throttle, throttleV2, transformHttpData };
76
+ export { CallbackQueue, MinHeap, base64, base64v2, debounce, decorateProp, dom2str, event2breadcrumb, getBaseData, getCssSelectors, isError, isErrorEvent, isExcludedApi, isHTMLElement, isIExtendedErrorEvent, metric2perfData, _default as sentry, throttle, throttleV2, transformHttpData };
package/dist/index.js CHANGED
@@ -226,10 +226,15 @@ function getCssSelectors(elem) {
226
226
  return [idSelector, classSelector + attrSelector, elemSelector];
227
227
  }
228
228
 
229
- function getTime() {
229
+ function getBaseData() {
230
230
  return {
231
+ id: crypto.randomUUID(),
232
+ message: "",
233
+ timestamp: Date.now(),
231
234
  time: (/* @__PURE__ */ new Date()).toISOString(),
232
- timestamp: Date.now()
235
+ name: "",
236
+ status: Status.OK,
237
+ type: EventType.Custom
233
238
  };
234
239
  }
235
240
 
@@ -1797,14 +1802,12 @@ function isIExtendedErrorEvent(err) {
1797
1802
  function metric2perfData(metric) {
1798
1803
  const { id, name, value, rating } = metric;
1799
1804
  return {
1805
+ ...getBaseData(),
1800
1806
  id,
1801
1807
  name,
1802
1808
  value,
1803
1809
  rating,
1804
- message: "",
1805
- ...getTime(),
1806
- type: EventType.Performance,
1807
- status: Status.OK
1810
+ type: EventType.Performance
1808
1811
  };
1809
1812
  }
1810
1813
 
@@ -1850,5 +1853,5 @@ function transformHttpData(data) {
1850
1853
  return data;
1851
1854
  }
1852
1855
 
1853
- export { CallbackQueue, MinHeap, base64, base64v2, debounce, decorateProp, dom2str, event2breadcrumb, getCssSelectors, getTime, isError, isErrorEvent, isExcludedApi, isHTMLElement, isIExtendedErrorEvent, metric2perfData, sentry, throttle, throttleV2, transformHttpData };
1856
+ export { CallbackQueue, MinHeap, base64, base64v2, debounce, decorateProp, dom2str, event2breadcrumb, getBaseData, getCssSelectors, isError, isErrorEvent, isExcludedApi, isHTMLElement, isIExtendedErrorEvent, metric2perfData, sentry, throttle, throttleV2, transformHttpData };
1854
1857
  //# sourceMappingURL=index.js.map