@lark-apaas/observable-web 1.0.0-alpha.2 → 1.0.0-alpha.4

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.
@@ -0,0 +1,11 @@
1
+ declare const defaultResourceAttr: {
2
+ sdk_version: string;
3
+ sdk_lang: string;
4
+ sdk_type: string;
5
+ };
6
+ declare enum AppEnv {
7
+ Dev = "preview",
8
+ Prod = "runtime"
9
+ }
10
+
11
+ export { AppEnv, defaultResourceAttr };
package/dist/lib/const.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -0,0 +1,17 @@
1
+ import { Meter } from '@opentelemetry/api';
2
+
3
+ declare class PvInstrumentation {
4
+ private meter;
5
+ private lastUrl;
6
+ constructor(meter: Meter);
7
+ /**
8
+ * 开启自动采集
9
+ */
10
+ enable(): void;
11
+ /**
12
+ * Monkey Patch 历史记录 API
13
+ */
14
+ private patchHistory;
15
+ }
16
+
17
+ export { PvInstrumentation };
@@ -1,8 +1,8 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
8
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -16,7 +16,6 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
20
19
  var PvInstrumentation_exports = {};
21
20
  __export(PvInstrumentation_exports, {
22
21
  PvInstrumentation: () => PvInstrumentation
@@ -25,15 +24,13 @@ module.exports = __toCommonJS(PvInstrumentation_exports);
25
24
  var import_getDeviceID = require("../../utils/getDeviceID");
26
25
  class PvInstrumentation {
27
26
  constructor(meter) {
28
- __publicField(this, "meter");
29
- __publicField(this, "lastUrl");
30
27
  this.meter = meter;
31
28
  }
32
29
  /**
33
30
  * 开启自动采集
34
31
  */
35
32
  enable() {
36
- const pvCounter = this.meter.createCounter("page_view", {
33
+ const pvCounter = this.meter.createCounter("apaas_internal_metrics_pv_uv", {
37
34
  description: "Count of page views"
38
35
  });
39
36
  const reportPv = () => {
@@ -0,0 +1,25 @@
1
+ import { LogRecordExporter, ReadableLogRecord } from '@opentelemetry/sdk-logs';
2
+ import { ExportResult } from '@opentelemetry/core';
3
+ import { AppEnv } from '../const.js';
4
+
5
+ interface CustomExporterConfig {
6
+ url: string;
7
+ /** 环境标识 */
8
+ env: AppEnv;
9
+ /** 自定义请求头 (例如鉴权 Token) */
10
+ headers?: Record<string, string>;
11
+ }
12
+ declare class CustomWebLogExporter implements LogRecordExporter {
13
+ private url;
14
+ private headers;
15
+ private appEnv;
16
+ constructor(config: CustomExporterConfig);
17
+ export(logs: ReadableLogRecord[], resultCallback: (result: ExportResult) => void): void;
18
+ /**
19
+ * 封装 Fetch 逻辑
20
+ */
21
+ private sendWithFetch;
22
+ shutdown(): Promise<void>;
23
+ }
24
+
25
+ export { type CustomExporterConfig, CustomWebLogExporter };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -29,7 +30,6 @@ var __copyProps = (to, from, except, desc) => {
29
30
  return to;
30
31
  };
31
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
33
33
  var __async = (__this, __arguments, generator) => {
34
34
  return new Promise((resolve, reject) => {
35
35
  var fulfilled = (value) => {
@@ -62,9 +62,6 @@ var import_generateUUID = require("../utils/generateUUID");
62
62
  var import_const = require("../const");
63
63
  class CustomWebLogExporter {
64
64
  constructor(config) {
65
- __publicField(this, "url");
66
- __publicField(this, "headers");
67
- __publicField(this, "appEnv");
68
65
  this.url = config.url;
69
66
  this.appEnv = config.env;
70
67
  this.headers = config.headers || {};
@@ -0,0 +1,42 @@
1
+ import { PushMetricExporter, ResourceMetrics, AggregationTemporality } from '@opentelemetry/sdk-metrics';
2
+ import { ExportResult } from '@opentelemetry/core';
3
+
4
+ interface CustomExporterConfig {
5
+ url: string;
6
+ headers?: Record<string, string>;
7
+ }
8
+ declare class CustomWebMetricExporter implements PushMetricExporter {
9
+ private url;
10
+ private headers;
11
+ private _shutdown;
12
+ constructor(config: CustomExporterConfig);
13
+ export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void;
14
+ /**
15
+ * 将 OTel ResourceMetrics 转换为目标 MetricsData
16
+ */
17
+ private transform;
18
+ /**
19
+ * 转换数值型数据点 (Sum / Gauge)
20
+ */
21
+ private transformNumberDataPoints;
22
+ /**
23
+ * 转换直方图数据点
24
+ */
25
+ private transformHistogramDataPoints;
26
+ /**
27
+ * 映射聚合时间枚举
28
+ */
29
+ private mapTemporality;
30
+ /**
31
+ * 强制使用 DELTA 模式 (Web 端通常推荐)
32
+ */
33
+ forceFlush(): Promise<void>;
34
+ selectAggregationTemporality(_instrumentType: any): AggregationTemporality;
35
+ shutdown(): Promise<void>;
36
+ /**
37
+ * 发送逻辑
38
+ */
39
+ private send;
40
+ }
41
+
42
+ export { type CustomExporterConfig, CustomWebMetricExporter };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -29,7 +30,6 @@ var __copyProps = (to, from, except, desc) => {
29
30
  return to;
30
31
  };
31
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
33
33
  var __async = (__this, __arguments, generator) => {
34
34
  return new Promise((resolve, reject) => {
35
35
  var fulfilled = (value) => {
@@ -62,9 +62,7 @@ var import_convertAllAttrIntoString = require("../utils/convertAllAttrIntoString
62
62
  var import_hrTimeToNanoNumber = require("../utils/hrTimeToNanoNumber");
63
63
  class CustomWebMetricExporter {
64
64
  constructor(config) {
65
- __publicField(this, "url");
66
- __publicField(this, "headers");
67
- __publicField(this, "_shutdown", false);
65
+ this._shutdown = false;
68
66
  this.url = config.url;
69
67
  this.headers = config.headers || {};
70
68
  }
@@ -0,0 +1,21 @@
1
+ import { ResourceDetector, ResourceDetectionConfig, DetectedResource } from '@opentelemetry/resources';
2
+
3
+ declare global {
4
+ interface Window {
5
+ appId: string;
6
+ tenantID: string;
7
+ userId: string;
8
+ }
9
+ }
10
+ /**
11
+ * 自定义 Web 环境探测器
12
+ */
13
+ declare class CustomWebDetector implements ResourceDetector {
14
+ /**
15
+ * 核心探测方法
16
+ * @param config 探测配置(通常用不到,但接口要求)
17
+ */
18
+ detect(config?: ResourceDetectionConfig): DetectedResource;
19
+ }
20
+
21
+ export { CustomWebDetector };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -0,0 +1,33 @@
1
+ import { AppEnv } from '../const.js';
2
+
3
+ interface WebSdkConfig {
4
+ serviceName: string;
5
+ env: AppEnv;
6
+ collectorUrl: {
7
+ log: string;
8
+ metric: string;
9
+ };
10
+ headers?: Record<string, string>;
11
+ }
12
+ declare class WebObservableSdk {
13
+ private static _instance;
14
+ private loggerProvider;
15
+ private meterProvider;
16
+ private logger;
17
+ private meter;
18
+ private resource;
19
+ private config;
20
+ private isStarted;
21
+ constructor();
22
+ static get instance(): WebObservableSdk;
23
+ start(config: WebSdkConfig): void;
24
+ private initLogs;
25
+ private initMetrics;
26
+ private initAutoPv;
27
+ log(level: 'INFO' | 'ERROR' | 'WARN', message: string, attributes?: Record<string, any>): void;
28
+ addCount(name: string, value?: number, attributes?: Record<string, any>): void;
29
+ shutdown(): Promise<void>;
30
+ }
31
+ declare const observable: WebObservableSdk;
32
+
33
+ export { WebObservableSdk, type WebSdkConfig, observable };
@@ -1,8 +1,8 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
8
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -16,7 +16,6 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
20
19
  var __async = (__this, __arguments, generator) => {
21
20
  return new Promise((resolve, reject) => {
22
21
  var fulfilled = (value) => {
@@ -50,19 +49,13 @@ var import_sdk_metrics = require("@opentelemetry/sdk-metrics");
50
49
  var import_resource_detector = require("./resource-detector");
51
50
  var import_metric_exporter = require("./metric-exporter");
52
51
  var import_PvInstrumentation = require("./instrumentation/PvInstrumentation");
53
- const _WebObservableSdk = class _WebObservableSdk {
52
+ class WebObservableSdk {
54
53
  constructor() {
55
- __publicField(this, "loggerProvider");
56
- __publicField(this, "meterProvider");
57
- __publicField(this, "logger");
58
- __publicField(this, "meter");
59
- __publicField(this, "resource");
60
- __publicField(this, "config");
61
- __publicField(this, "isStarted", false);
54
+ this.isStarted = false;
62
55
  }
63
56
  static get instance() {
64
57
  if (!this._instance) {
65
- this._instance = new _WebObservableSdk();
58
+ this._instance = new WebObservableSdk();
66
59
  }
67
60
  return this._instance;
68
61
  }
@@ -123,7 +116,7 @@ const _WebObservableSdk = class _WebObservableSdk {
123
116
  }
124
117
  initAutoPv() {
125
118
  var _a;
126
- const meter = (_a = this.meterProvider) == null ? void 0 : _a.getMeter("web-sdk-pv-instrumentation");
119
+ const meter = (_a = this.meterProvider) == null ? void 0 : _a.getMeter("apaas_internal_metrics_pv_uv");
127
120
  if (!meter) return;
128
121
  const pvTracker = new import_PvInstrumentation.PvInstrumentation(meter);
129
122
  pvTracker.enable();
@@ -153,7 +146,5 @@ const _WebObservableSdk = class _WebObservableSdk {
153
146
  ]);
154
147
  });
155
148
  }
156
- };
157
- __publicField(_WebObservableSdk, "_instance");
158
- let WebObservableSdk = _WebObservableSdk;
149
+ }
159
150
  const observable = WebObservableSdk.instance;
@@ -0,0 +1,2 @@
1
+ export { observable } from './core/sdk.js';
2
+ export { AppEnv } from './const.js';
package/dist/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -0,0 +1,336 @@
1
+ declare enum AggregationTemporality {
2
+ AGGREGATION_TEMPORALITY_UNSPECIFIED = 0,//未指定(禁止使用)
3
+ AGGREGATION_TEMPORALITY_DELTA = 1,//增量聚合(自上次报告以来的变化)
4
+ AGGREGATION_TEMPORALITY_CUMULATIVE = 2
5
+ }
6
+ interface Buckets {
7
+ /**
8
+ *桶偏移量(必选)
9
+ */
10
+ offset?: number;
11
+ /**
12
+ *桶计数列表(必选)
13
+ */
14
+ bucketCounts?: number[];
15
+ }
16
+ interface CollectMetricsRequest {
17
+ metricsData: MetricsData;
18
+ }
19
+ interface Exemplar {
20
+ /**
21
+ *过滤后的属性(必选)
22
+ */
23
+ filteredAttributes?: Record<string, string>;
24
+ /**
25
+ *样本时间戳(纳秒级 Unix 时间,必选)
26
+ */
27
+ timeUnixNano?: number;
28
+ /**
29
+ *浮点型样本值(与 AsInt 二选一)
30
+ */
31
+ asDouble?: number;
32
+ /**
33
+ *整型样本值(与 AsDouble 二选一)
34
+ */
35
+ asInt?: number;
36
+ /**
37
+ *关联的追踪 ID(16 字节,可选)
38
+ */
39
+ traceID?: string;
40
+ /**
41
+ *关联的跨度 ID(8 字节,可选)
42
+ */
43
+ spanID?: string;
44
+ }
45
+ interface ExponentialHistogram {
46
+ /**
47
+ *数据点列表(至少为空列表,必选)
48
+ */
49
+ dataPoints?: ExponentialHistogramDataPoint[];
50
+ /**
51
+ *聚合时间特性(必选)
52
+ */
53
+ aggregationTemporality?: AggregationTemporality;
54
+ }
55
+ interface ExponentialHistogramDataPoint {
56
+ /**
57
+ *数据点属性(键唯一,可选)
58
+ */
59
+ attributes?: Record<string, string>;
60
+ /**
61
+ *起始时间戳(纳秒级,可选,强烈建议设置)
62
+ */
63
+ startTimeUnixNano?: number;
64
+ /**
65
+ *结束时间戳(纳秒级,必选)
66
+ */
67
+ timeUnixNano?: number;
68
+ /**
69
+ *样本总数(非负,必选)
70
+ */
71
+ count?: number;
72
+ /**
73
+ *样本总和(可选,count 为 0 时必须为 0)
74
+ */
75
+ sum?: number;
76
+ /**
77
+ *分辨率缩放因子(必选)
78
+ */
79
+ scale?: number;
80
+ /**
81
+ *零值样本数(必选)
82
+ */
83
+ zeroCount?: number;
84
+ /**
85
+ *正数值桶计数(可选)
86
+ */
87
+ positive?: Buckets;
88
+ /**
89
+ *负数值桶计数(可选)
90
+ */
91
+ negative?: Buckets;
92
+ /**
93
+ *标志位(参考 DataPointFlags,可选)
94
+ */
95
+ flags?: number;
96
+ /**
97
+ *样本列表(可选)
98
+ */
99
+ exemplars?: Exemplar[];
100
+ /**
101
+ *最小值(可选)
102
+ */
103
+ min?: number;
104
+ /**
105
+ *最大值(可选)
106
+ */
107
+ max?: number;
108
+ /**
109
+ *零值阈值(可选)
110
+ */
111
+ zeroThreshold?: number;
112
+ }
113
+ interface Gauge {
114
+ /**
115
+ *数据点列表(至少为空列表,必选)
116
+ */
117
+ dataPoints?: NumberDataPoint[];
118
+ }
119
+ interface Histogram {
120
+ /**
121
+ *数据点列表(至少为空列表,必选)
122
+ */
123
+ dataPoints?: HistogramDataPoint[];
124
+ /**
125
+ *聚合时间特性(必选)
126
+ */
127
+ aggregationTemporality?: AggregationTemporality;
128
+ }
129
+ interface HistogramDataPoint {
130
+ /**
131
+ *数据点属性(键唯一,可选)
132
+ */
133
+ attributes?: Record<string, string>;
134
+ /**
135
+ *起始时间戳(纳秒级,可选,强烈建议设置)
136
+ */
137
+ startTimeUnixNano?: number;
138
+ /**
139
+ *结束时间戳(纳秒级,必选)
140
+ */
141
+ timeUnixNano?: number;
142
+ /**
143
+ *样本总数(非负,必选)
144
+ */
145
+ count?: number;
146
+ /**
147
+ *样本总和(可选,count 为 0 时必须为 0)
148
+ */
149
+ sum?: number;
150
+ /**
151
+ *每个桶的样本数(可选)
152
+ */
153
+ bucketCounts?: number[];
154
+ /**
155
+ *桶的边界值(可选)
156
+ */
157
+ explicitBounds?: number[];
158
+ /**
159
+ *最小值(可选)
160
+ */
161
+ min?: number;
162
+ /**
163
+ *最大值(可选)
164
+ */
165
+ max?: number;
166
+ /**
167
+ *样本列表(可选)
168
+ */
169
+ exemplars?: Exemplar[];
170
+ /**
171
+ *标志位(参考 DataPointFlags,可选)
172
+ */
173
+ flags?: number;
174
+ }
175
+ interface Metric {
176
+ /**
177
+ *指标名称(必选)
178
+ */
179
+ name?: string;
180
+ /**
181
+ *指标描述(可选)
182
+ */
183
+ description?: string;
184
+ /**
185
+ *指标单位(遵循 UCUM 格式,可选)
186
+ */
187
+ unit?: string;
188
+ /**
189
+ *gauge 类型数据(与其他数据类型互斥)
190
+ */
191
+ gauge?: Gauge;
192
+ /**
193
+ *sum 类型数据(与其他数据类型互斥)
194
+ */
195
+ sum?: Sum;
196
+ /**
197
+ *直方图类型数据(与其他数据类型互斥)
198
+ */
199
+ histogram?: Histogram;
200
+ /**
201
+ *指数直方图类型数据(与其他数据类型互斥)
202
+ */
203
+ exponentialHistogram?: ExponentialHistogram;
204
+ /**
205
+ *摘要类型数据(与其他数据类型互斥)
206
+ */
207
+ summary?: Summary;
208
+ /**
209
+ *附加元数据(非标识性,可选)
210
+ */
211
+ metadata?: Record<string, string>;
212
+ /**
213
+ *指标范围名称(可选)
214
+ */
215
+ scopeName?: string;
216
+ }
217
+ interface MetricsData {
218
+ /**
219
+ *资源信息(可选,未设置表示未知)
220
+ */
221
+ resource?: Resource;
222
+ /**
223
+ *范围指标列表(至少为空列表,语义必填)
224
+ */
225
+ metrics?: Metric[];
226
+ /**
227
+ *资源数据遵循的 schema URL(可选)
228
+ */
229
+ schemaURL?: string;
230
+ }
231
+ interface NumberDataPoint {
232
+ /**
233
+ *起始时间戳(纳秒级,可选,强烈建议设置)
234
+ */
235
+ startTimeUnixNano?: number;
236
+ /**
237
+ *结束时间戳(纳秒级,必选)
238
+ */
239
+ timeUnixNano?: number;
240
+ /**
241
+ *浮点值(与 AsInt 二选一,必选其一)
242
+ */
243
+ asDouble?: number;
244
+ /**
245
+ *样本列表(可选)
246
+ */
247
+ exemplars?: Exemplar[];
248
+ /**
249
+ *整数值(与 AsDouble 二选一,必选其一)
250
+ */
251
+ asInt?: number;
252
+ /**
253
+ *数据点属性(键唯一,可选)
254
+ */
255
+ attributes?: Record<string, string>;
256
+ /**
257
+ *标志位(参考 DataPointFlags,可选)
258
+ */
259
+ flags?: number;
260
+ }
261
+ interface Resource {
262
+ /**
263
+ *资源属性列表,键必须唯一
264
+ */
265
+ attributes?: Record<string, string>;
266
+ /**
267
+ *被丢弃的属性数量,默认 0
268
+ */
269
+ droppedAttributesCount?: number;
270
+ /**
271
+ *资源数据遵循的 schema URL
272
+ */
273
+ schemaURL?: string;
274
+ }
275
+ interface Sum {
276
+ /**
277
+ *数据点列表(至少为空列表,必选)
278
+ */
279
+ dataPoints?: NumberDataPoint[];
280
+ /**
281
+ *聚合时间特性(必选)
282
+ */
283
+ aggregationTemporality?: AggregationTemporality;
284
+ /**
285
+ *是否单调递增(必选)
286
+ */
287
+ isMonotonic?: boolean;
288
+ }
289
+ interface Summary {
290
+ /**
291
+ *数据点列表(至少为空列表,必选)
292
+ */
293
+ dataPoints?: SummaryDataPoint[];
294
+ }
295
+ interface SummaryDataPoint {
296
+ /**
297
+ *数据点属性(键唯一,可选)
298
+ */
299
+ attributes?: Record<string, string>;
300
+ /**
301
+ *起始时间戳(纳秒级,可选,强烈建议设置)
302
+ */
303
+ startTimeUnixNano?: number;
304
+ /**
305
+ *结束时间戳(纳秒级,必选)
306
+ */
307
+ timeUnixNano?: number;
308
+ /**
309
+ *样本总数(非负,必选)
310
+ */
311
+ count?: number;
312
+ /**
313
+ *样本总和(必选)
314
+ */
315
+ sum?: number;
316
+ /**
317
+ *分位数对应的数值(必选)
318
+ */
319
+ quantileValues?: ValueAtQuantile[];
320
+ /**
321
+ *标志位(参考 DataPointFlags,可选)
322
+ */
323
+ flags?: number;
324
+ }
325
+ interface ValueAtQuantile {
326
+ /**
327
+ *分位数(0 ≤ quantile ≤ 1,必选)
328
+ */
329
+ quantile?: number;
330
+ /**
331
+ *分位数值(必选)
332
+ */
333
+ value?: number;
334
+ }
335
+
336
+ export { AggregationTemporality, type Buckets, type CollectMetricsRequest, type Exemplar, type ExponentialHistogram, type ExponentialHistogramDataPoint, type Gauge, type Histogram, type HistogramDataPoint, type Metric, type MetricsData, type NumberDataPoint, type Resource, type Sum, type Summary, type SummaryDataPoint, type ValueAtQuantile };
package/dist/lib/types.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -0,0 +1,3 @@
1
+ declare function convertAttributesToString(attributes: Record<string, unknown>): Record<string, string>;
2
+
3
+ export { convertAttributesToString };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -0,0 +1,3 @@
1
+ declare const generateUUID: () => string;
2
+
3
+ export { generateUUID };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -0,0 +1,3 @@
1
+ declare const getDeviceId: () => string;
2
+
3
+ export { getDeviceId };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -0,0 +1,10 @@
1
+ import { HrTime } from '@opentelemetry/api';
2
+
3
+ /**
4
+ * 将 HrTime 转换为纳秒数字
5
+ * 注意:JavaScript Number 类型只能精确表示整数到 2^53,对于超过此范围的纳秒值会丢失精度
6
+ * 此实现不使用 BigInt,具有更好的浏览器兼容性
7
+ */
8
+ declare function hrTimeToNanosNumber(hrTime: HrTime): number;
9
+
10
+ export { hrTimeToNanosNumber };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/observable-web",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.4",
4
4
  "description": "Observable SDK For Web",
5
5
  "main": "./dist/lib/index.js",
6
6
  "files": [