@pluve/logger-sdk 0.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.
@@ -0,0 +1,7 @@
1
+ export interface StorageAdapter {
2
+ get(): Promise<string | null>;
3
+ set(val: string): Promise<void>;
4
+ remove(): Promise<void>;
5
+ }
6
+ export declare function browserStorage(key: string): StorageAdapter;
7
+ export declare function wechatStorage(key: string): StorageAdapter;
@@ -0,0 +1,139 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ /*
6
+ * @Author : 黄震 huangzhen@yfpharmacy.com
7
+ * @Date : 2025-11-21 14:33:56
8
+ * @LastEditors : 黄震 huangzhen@yfpharmacy.com
9
+ * @LastEditTime : 2025-11-21 14:34:17
10
+ * @Description : 存储适配器接口
11
+ * Copyright (c) 2025 by 益丰大药房连锁股份有限公司, All Rights Reserved.
12
+ */
13
+ // 存储适配器接口:统一不同运行环境下的持久化能力
14
+
15
+ // 浏览器环境:使用 localStorage 简单持久化
16
+ export function browserStorage(key) {
17
+ return {
18
+ get: function get() {
19
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
20
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ return _context.abrupt("return", Promise.resolve(localStorage.getItem(key)));
24
+ case 1:
25
+ case "end":
26
+ return _context.stop();
27
+ }
28
+ }, _callee);
29
+ }))();
30
+ },
31
+ set: function set(val) {
32
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
33
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
34
+ while (1) switch (_context2.prev = _context2.next) {
35
+ case 0:
36
+ localStorage.setItem(key, val);
37
+ return _context2.abrupt("return", Promise.resolve());
38
+ case 2:
39
+ case "end":
40
+ return _context2.stop();
41
+ }
42
+ }, _callee2);
43
+ }))();
44
+ },
45
+ remove: function remove() {
46
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
47
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
48
+ while (1) switch (_context3.prev = _context3.next) {
49
+ case 0:
50
+ localStorage.removeItem(key);
51
+ return _context3.abrupt("return", Promise.resolve());
52
+ case 2:
53
+ case "end":
54
+ return _context3.stop();
55
+ }
56
+ }, _callee3);
57
+ }))();
58
+ }
59
+ };
60
+ }
61
+
62
+ // 微信小程序环境:封装 wx.*Storage API
63
+ export function wechatStorage(key) {
64
+ return {
65
+ get: function get() {
66
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
67
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
68
+ while (1) switch (_context4.prev = _context4.next) {
69
+ case 0:
70
+ return _context4.abrupt("return", new Promise(function (res) {
71
+ // @ts-ignore
72
+ wx.getStorage({
73
+ key: key,
74
+ success: function success(r) {
75
+ return res(r.data);
76
+ },
77
+ fail: function fail() {
78
+ return res(null);
79
+ }
80
+ });
81
+ }));
82
+ case 1:
83
+ case "end":
84
+ return _context4.stop();
85
+ }
86
+ }, _callee4);
87
+ }))();
88
+ },
89
+ set: function set(val) {
90
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
91
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
92
+ while (1) switch (_context5.prev = _context5.next) {
93
+ case 0:
94
+ return _context5.abrupt("return", new Promise(function (res) {
95
+ // @ts-ignore
96
+ wx.setStorage({
97
+ key: key,
98
+ data: val,
99
+ success: function success() {
100
+ return res(undefined);
101
+ },
102
+ fail: function fail() {
103
+ return res(undefined);
104
+ }
105
+ });
106
+ }));
107
+ case 1:
108
+ case "end":
109
+ return _context5.stop();
110
+ }
111
+ }, _callee5);
112
+ }))();
113
+ },
114
+ remove: function remove() {
115
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
116
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
117
+ while (1) switch (_context6.prev = _context6.next) {
118
+ case 0:
119
+ return _context6.abrupt("return", new Promise(function (res) {
120
+ // @ts-ignore
121
+ wx.removeStorage({
122
+ key: key,
123
+ success: function success() {
124
+ return res(undefined);
125
+ },
126
+ fail: function fail() {
127
+ return res(undefined);
128
+ }
129
+ });
130
+ }));
131
+ case 1:
132
+ case "end":
133
+ return _context6.stop();
134
+ }
135
+ }, _callee6);
136
+ }))();
137
+ }
138
+ };
139
+ }
@@ -0,0 +1,5 @@
1
+ import { SDKOptions } from "./types";
2
+ export declare function defaultTransport(payload: any, opts?: SDKOptions & {
3
+ endpoint?: string;
4
+ headers?: Record<string, string>;
5
+ }): Promise<void>;
@@ -0,0 +1,142 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
10
+ /*
11
+ * @Author : 黄震 huangzhen@yfpharmacy.com
12
+ * @Date : 2025-11-21 14:35:48
13
+ * @LastEditors : 黄震 huangzhen@yfpharmacy.com
14
+ * @LastEditTime : 2025-12-02 15:18:05
15
+ * @Description : 传输适配器接口,用于发送日志到服务器
16
+ * Copyright (c) 2025 by 益丰大药房连锁股份有限公司, All Rights Reserved.
17
+ */
18
+
19
+ import { isWeChatMiniProgram, safeStringify, isBrowser, now } from "./utils";
20
+ export function defaultTransport(_x, _x2) {
21
+ return _defaultTransport.apply(this, arguments);
22
+ }
23
+ function _defaultTransport() {
24
+ _defaultTransport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload, opts) {
25
+ var _endpoints;
26
+ var body, timeout, endpoint, blob, ok, param, cacheBuster, urlBase, qs, url, maxLen, img, controller;
27
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
28
+ while (1) switch (_context.prev = _context.next) {
29
+ case 0:
30
+ body = typeof payload === 'string' ? payload : safeStringify(payload);
31
+ timeout = (opts === null || opts === void 0 ? void 0 : opts.timeout) || 10000;
32
+ endpoint = opts && opts.endpoint ? opts.endpoint : ((_endpoints = opts.endpoints) === null || _endpoints === void 0 ? void 0 : _endpoints.default) || '';
33
+ if (!(isBrowser() && typeof navigator !== 'undefined' && typeof navigator.sendBeacon === 'function' && opts !== null && opts !== void 0 && opts.useBeacon)) {
34
+ _context.next = 9;
35
+ break;
36
+ }
37
+ blob = new Blob([body], {
38
+ type: 'application/json'
39
+ });
40
+ ok = navigator.sendBeacon(endpoint || '', blob);
41
+ if (!ok) {
42
+ _context.next = 8;
43
+ break;
44
+ }
45
+ return _context.abrupt("return", Promise.resolve());
46
+ case 8:
47
+ return _context.abrupt("return", Promise.reject(new Error('sendBeacon failed')));
48
+ case 9:
49
+ if (!isWeChatMiniProgram()) {
50
+ _context.next = 11;
51
+ break;
52
+ }
53
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
54
+ var timer = null;
55
+ // @ts-ignore
56
+ wx.request({
57
+ url: endpoint || '',
58
+ method: 'POST',
59
+ data: body,
60
+ header: _objectSpread({
61
+ 'Content-Type': 'application/json'
62
+ }, opts && opts.globalHeaders ? opts.globalHeaders : {}),
63
+ success: function success() {
64
+ if (timer) clearTimeout(timer);
65
+ resolve();
66
+ },
67
+ fail: function fail(err) {
68
+ if (timer) clearTimeout(timer);
69
+ reject(err);
70
+ }
71
+ });
72
+ timer = setTimeout(function () {
73
+ return reject(new Error('timeout'));
74
+ }, timeout);
75
+ }));
76
+ case 11:
77
+ if (!(isBrowser() && opts !== null && opts !== void 0 && opts.usePixel)) {
78
+ _context.next = 23;
79
+ break;
80
+ }
81
+ param = (opts === null || opts === void 0 ? void 0 : opts.pixelParam) || 'data';
82
+ cacheBuster = "_=".concat(now());
83
+ urlBase = endpoint || '';
84
+ qs = "".concat(param, "=").concat(encodeURIComponent(body), "&").concat(cacheBuster);
85
+ url = urlBase.includes('?') ? "".concat(urlBase, "&").concat(qs) : "".concat(urlBase, "?").concat(qs);
86
+ maxLen = (opts === null || opts === void 0 ? void 0 : opts.maxPixelUrlLen) || 1900;
87
+ if (!(url.length > maxLen)) {
88
+ _context.next = 21;
89
+ break;
90
+ }
91
+ _context.next = 23;
92
+ break;
93
+ case 21:
94
+ // 使用 Image 像素上报
95
+ img = new Image();
96
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
97
+ var timer = null;
98
+ img.onload = function () {
99
+ if (timer) clearTimeout(timer);
100
+ resolve();
101
+ };
102
+ img.onerror = function () {
103
+ if (timer) clearTimeout(timer);
104
+ reject(new Error('pixel error'));
105
+ };
106
+ timer = setTimeout(function () {
107
+ return reject(new Error('timeout'));
108
+ }, timeout);
109
+ img.src = url;
110
+ }));
111
+ case 23:
112
+ if (!(typeof fetch === 'function')) {
113
+ _context.next = 27;
114
+ break;
115
+ }
116
+ controller = typeof AbortController !== 'undefined' ? new AbortController() : null;
117
+ if (controller) setTimeout(function () {
118
+ return controller.abort();
119
+ }, timeout);
120
+ return _context.abrupt("return", fetch(endpoint || '', {
121
+ method: 'POST',
122
+ headers: _objectSpread(_objectSpread({
123
+ 'Content-Type': 'application/json'
124
+ }, opts && opts.globalHeaders ? opts.globalHeaders : {}), opts && opts.headers ? opts.headers : {}),
125
+ body: body,
126
+ // 在页面关闭场景提供尽力传输能力(非标准环境忽略)
127
+ // @ts-ignore
128
+ keepalive: opts !== null && opts !== void 0 && opts.useBeacon ? true : undefined,
129
+ signal: controller ? controller.signal : undefined
130
+ }).then(function (res) {
131
+ if (!res.ok) throw new Error('network response not ok');
132
+ }));
133
+ case 27:
134
+ return _context.abrupt("return", Promise.reject(new Error('no transport available')));
135
+ case 28:
136
+ case "end":
137
+ return _context.stop();
138
+ }
139
+ }, _callee);
140
+ }));
141
+ return _defaultTransport.apply(this, arguments);
142
+ }
@@ -0,0 +1,35 @@
1
+ export type Env = 'h5' | 'wechat' | 'unknown';
2
+ export type LogEventType = 'event' | 'error' | 'pageview' | 'perf' | 'custom';
3
+ export type LogEventLevel = 'info' | 'warn' | 'error' | 'debug';
4
+ export interface SDKOptions {
5
+ endpoints: Partial<Record<'info' | 'warn' | 'error' | 'default', string>>;
6
+ appId?: string;
7
+ env?: Env;
8
+ batchSize?: number;
9
+ flushInterval?: number;
10
+ retryCount?: number;
11
+ retryBase?: number;
12
+ storageKey?: string;
13
+ maxCacheSize?: number;
14
+ timeout?: number;
15
+ debug?: boolean;
16
+ transport?: (payload: any, opts?: SDKOptions & {
17
+ endpoint?: string;
18
+ headers?: Record<string, string>;
19
+ }) => Promise<void>;
20
+ globalHeaders?: Record<string, string>;
21
+ enableAutoPV?: boolean;
22
+ enablePerf?: boolean;
23
+ useBeacon?: boolean;
24
+ usePixel?: boolean;
25
+ pixelParam?: string;
26
+ maxPixelUrlLen?: number;
27
+ }
28
+ export interface LogEvent {
29
+ type: LogEventType;
30
+ time: number;
31
+ user?: Record<string, any>;
32
+ ctx?: Record<string, any>;
33
+ level?: LogEventLevel;
34
+ seq?: number;
35
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const now: () => number;
2
+ export declare function isWeChatMiniProgram(): boolean;
3
+ export declare function isBrowser(): boolean;
4
+ export declare function safeStringify(obj: any): string;
5
+ export declare function isIndexedDBAvailable(): boolean;
@@ -0,0 +1,53 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ /*
3
+ * @Author : 黄震 huangzhen@yfpharmacy.com
4
+ * @Date : 2025-11-21 14:31:33
5
+ * @LastEditors : 黄震 huangzhen@yfpharmacy.com
6
+ * @LastEditTime : 2025-12-02 15:31:27
7
+ * @Description : utils 工具函数
8
+ * Copyright (c) 2025 by 益丰大药房连锁股份有限公司, All Rights Reserved.
9
+ */
10
+ // 当前时间戳(毫秒)
11
+ export var now = function now() {
12
+ return Date.now();
13
+ };
14
+
15
+ // 判断是否在微信小程序环境
16
+ export function isWeChatMiniProgram() {
17
+ try {
18
+ // @ts-ignore
19
+ return typeof wx !== 'undefined' && typeof wx.request === 'function';
20
+ } catch (e) {
21
+ return false;
22
+ }
23
+ }
24
+
25
+ // 判断是否在浏览器环境
26
+ export function isBrowser() {
27
+ try {
28
+ return typeof window !== 'undefined' && typeof window.document !== 'undefined';
29
+ } catch (e) {
30
+ return false;
31
+ }
32
+ }
33
+
34
+ // 安全 JSON 序列化:处理循环引用
35
+ export function safeStringify(obj) {
36
+ var seen = new WeakSet();
37
+ return JSON.stringify(obj, function (_k, v) {
38
+ if (v && _typeof(v) === 'object') {
39
+ if (seen.has(v)) return '[Circular]';
40
+ seen.add(v);
41
+ }
42
+ return v;
43
+ });
44
+ }
45
+
46
+ // 判断 IndexedDB 能力是否可用
47
+ export function isIndexedDBAvailable() {
48
+ try {
49
+ return typeof indexedDB !== 'undefined';
50
+ } catch (e) {
51
+ return false;
52
+ }
53
+ }
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.LoggerSDK=t():e.LoggerSDK=t()}(self,(function(){return function(){var e={750:function(e){function t(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=e.apply(r,n);function u(e){t(a,o,i,u,s,"next",e)}function s(e){t(a,o,i,u,s,"throw",e)}u(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},811:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},997:function(e,t,r){var n=r(969);function o(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}e.exports=function(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},411:function(e,t,r){var n=r(969);e.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},731:function(e,t,r){var n=r(411);function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e},e.exports.__esModule=!0,e.exports.default=e.exports},25:function(e,t,r){var n=r(505).default;function o(){"use strict";e.exports=o=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var t,r={},i=Object.prototype,a=i.hasOwnProperty,u=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},c=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",f=s.toStringTag||"@@toStringTag";function p(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(t){p=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var o=t&&t.prototype instanceof g?t:g,i=Object.create(o.prototype),a=new M(n||[]);return u(i,"_invoke",{value:_(e,r,a)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=h;var v="suspendedStart",y="executing",m="completed",b={};function g(){}function x(){}function w(){}var k={};p(k,c,(function(){return this}));var P=Object.getPrototypeOf,E=P&&P(P(N([])));E&&E!==i&&a.call(E,c)&&(k=E);var S=w.prototype=g.prototype=Object.create(k);function L(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function j(e,t){function r(o,i,u,s){var c=d(e[o],e,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,s)}),(function(e){r("throw",e,u,s)})):t.resolve(f).then((function(e){l.value=e,u(l)}),(function(e){return r("throw",e,u,s)}))}s(c.arg)}var o;u(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function _(e,r,n){var o=v;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var s=O(u,n);if(s){if(s===b)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var c=d(e,r,n);if("normal"===c.type){if(o=n.done?m:"suspendedYield",c.arg===b)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=m,n.method="throw",n.arg=c.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,b;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,b):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(a.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(n(e)+" is not iterable")}return x.prototype=w,u(S,"constructor",{value:w,configurable:!0}),u(w,"constructor",{value:x,configurable:!0}),x.displayName=p(w,f,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,p(e,f,"GeneratorFunction")),e.prototype=Object.create(S),e},r.awrap=function(e){return{__await:e}},L(j.prototype),p(j.prototype,l,(function(){return this})),r.AsyncIterator=j,r.async=function(e,t,n,o,i){void 0===i&&(i=Promise);var a=new j(h(e,t,n,o),i);return r.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},L(S),p(S,f,"Generator"),p(S,c,(function(){return this})),p(S,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=N,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),c=a.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,b):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),b},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),b}},r}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},159:function(e,t,r){var n=r(505).default;e.exports=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},969:function(e,t,r){var n=r(505).default,o=r(159);e.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},505:function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return function(){"use strict";r.r(n),r.d(n,{LoggerSDK:function(){return E}});var e=r(731),t=r.n(e),o=r(25),i=r.n(o),a=r(750),u=r.n(a),s=r(811),c=r.n(s),l=r(997),f=r.n(l),p=r(411),h=r.n(p),d=r(505),v=r.n(d),y=function(){return Date.now()};function m(){try{return"undefined"!=typeof wx&&"function"==typeof wx.request}catch(e){return!1}}function b(){try{return"undefined"!=typeof window&&void 0!==window.document}catch(e){return!1}}function g(e){var t=new WeakSet;return JSON.stringify(e,(function(e,r){if(r&&"object"===v()(r)){if(t.has(r))return"[Circular]";t.add(r)}return r}))}function x(){try{return"undefined"!=typeof indexedDB}catch(e){return!1}}var w=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"logger_sdk_db",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"queue";c()(this,e),h()(this,"dbName",void 0),h()(this,"storeName",void 0),h()(this,"db",null),this.dbName=t,this.storeName=r}var t,r,n,o;return f()(e,[{key:"open",value:(o=u()(i()().mark((function e(){var t=this;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b()&&x()){e.next=2;break}return e.abrupt("return");case 2:if(!this.db){e.next=4;break}return e.abrupt("return");case 4:return e.abrupt("return",new Promise((function(e,r){var n=indexedDB.open(t.dbName,1);n.onupgradeneeded=function(){var e=n.result;e.objectStoreNames.contains(t.storeName)||e.createObjectStore(t.storeName,{autoIncrement:!0})},n.onsuccess=function(){t.db=n.result,e()},n.onerror=function(){return r(n.error)}})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"add",value:(n=u()(i()().mark((function e(t){var r=this;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.db){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",new Promise((function(e,n){var o=r.db.transaction(r.storeName,"readwrite").objectStore(r.storeName).add(t);o.onsuccess=function(){return e()},o.onerror=function(){return n(o.error)}})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"getAll",value:(r=u()(i()().mark((function e(){var t=this;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.db){e.next=2;break}return e.abrupt("return",[]);case 2:return e.abrupt("return",new Promise((function(e,r){var n=t.db.transaction(t.storeName,"readonly").objectStore(t.storeName).getAll();n.onsuccess=function(){return e(n.result||[])},n.onerror=function(){return r(n.error)}})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"clear",value:(t=u()(i()().mark((function e(){var t=this;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.db){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",new Promise((function(e,r){var n=t.db.transaction(t.storeName,"readwrite").objectStore(t.storeName).clear();n.onsuccess=function(){return e(void 0)},n.onerror=function(){return r(n.error)}})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}();function k(e,t){return P.apply(this,arguments)}function P(){return(P=u()(i()().mark((function e(r,n){var o,a,u,s,c,l,f,p,h,d,v,x,w;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a="string"==typeof r?r:g(r),u=(null==n?void 0:n.timeout)||1e4,s=n&&n.endpoint?n.endpoint:(null===(o=n.endpoints)||void 0===o?void 0:o.default)||"",!b()||"undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon||null==n||!n.useBeacon){e.next=9;break}if(c=new Blob([a],{type:"application/json"}),!navigator.sendBeacon(s||"",c)){e.next=8;break}return e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",Promise.reject(new Error("sendBeacon failed")));case 9:if(!m()){e.next=11;break}return e.abrupt("return",new Promise((function(e,r){var o=null;wx.request({url:s||"",method:"POST",data:a,header:t()({"Content-Type":"application/json"},n&&n.globalHeaders?n.globalHeaders:{}),success:function(){o&&clearTimeout(o),e()},fail:function(e){o&&clearTimeout(o),r(e)}}),o=setTimeout((function(){return r(new Error("timeout"))}),u)})));case 11:if(!b()||null==n||!n.usePixel){e.next=23;break}if(l=(null==n?void 0:n.pixelParam)||"data",f="_=".concat(y()),p=s||"",h="".concat(l,"=").concat(encodeURIComponent(a),"&").concat(f),d=p.includes("?")?"".concat(p,"&").concat(h):"".concat(p,"?").concat(h),v=(null==n?void 0:n.maxPixelUrlLen)||1900,!(d.length>v)){e.next=21;break}e.next=23;break;case 21:return x=new Image,e.abrupt("return",new Promise((function(e,t){var r=null;x.onload=function(){r&&clearTimeout(r),e()},x.onerror=function(){r&&clearTimeout(r),t(new Error("pixel error"))},r=setTimeout((function(){return t(new Error("timeout"))}),u),x.src=d})));case 23:if("function"!=typeof fetch){e.next=27;break}return(w="undefined"!=typeof AbortController?new AbortController:null)&&setTimeout((function(){return w.abort()}),u),e.abrupt("return",fetch(s||"",{method:"POST",headers:t()(t()({"Content-Type":"application/json"},n&&n.globalHeaders?n.globalHeaders:{}),n&&n.headers?n.headers:{}),body:a,keepalive:!(null==n||!n.useBeacon)||void 0,signal:w?w.signal:void 0}).then((function(e){if(!e.ok)throw new Error("network response not ok")})));case 27:return e.abrupt("return",Promise.reject(new Error("no transport available")));case 28:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var E=function(){function e(t){var r=this;c()(this,e),h()(this,"opts",void 0),h()(this,"env",void 0),h()(this,"inMemoryQueue",[]),h()(this,"seq",0),h()(this,"timerId",null),h()(this,"storage",null),h()(this,"closed",!1),h()(this,"idbQueue",null),h()(this,"flushing",!1);var n,o={endpoints:t.endpoints||{},appId:t.appId||"",env:t.env||(m()?"wechat":b()?"h5":"unknown"),batchSize:t.batchSize||10,flushInterval:t.flushInterval||5e3,retryCount:t.retryCount||3,retryBase:t.retryBase||300,storageKey:t.storageKey||"logger_sdk_cache_v2",maxCacheSize:t.maxCacheSize||2e3,timeout:t.timeout||1e4,debug:!!t.debug,transport:t.transport||k,globalHeaders:t.globalHeaders||{},enableAutoPV:!1!==t.enableAutoPV,enablePerf:!1!==t.enablePerf,usePixel:t.usePixel||!1,pixelParam:t.pixelParam||"data",maxPixelUrlLen:t.maxPixelUrlLen||1900};this.opts=Object.assign(o,t),this.env=this.opts.env,"wechat"===this.env?this.storage=(n=this.opts.storageKey,{get:function(){return u()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){wx.getStorage({key:n,success:function(t){return e(t.data)},fail:function(){return e(null)}})})));case 1:case"end":return e.stop()}}),e)})))()},set:function(e){return u()(i()().mark((function t(){return i()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){wx.setStorage({key:n,data:e,success:function(){return t(void 0)},fail:function(){return t(void 0)}})})));case 1:case"end":return t.stop()}}),t)})))()},remove:function(){return u()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){wx.removeStorage({key:n,success:function(){return e(void 0)},fail:function(){return e(void 0)}})})));case 1:case"end":return e.stop()}}),e)})))()}}):"h5"===this.env?this.storage=function(e){return{get:function(){return u()(i()().mark((function t(){return i()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Promise.resolve(localStorage.getItem(e)));case 1:case"end":return t.stop()}}),t)})))()},set:function(t){return u()(i()().mark((function r(){return i()().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return localStorage.setItem(e,t),r.abrupt("return",Promise.resolve());case 2:case"end":return r.stop()}}),r)})))()},remove:function(){return u()(i()().mark((function t(){return i()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return localStorage.removeItem(e),t.abrupt("return",Promise.resolve());case 2:case"end":return t.stop()}}),t)})))()}}}(this.opts.storageKey):this.storage=null,b()&&x()&&(this.idbQueue=new w("logger_sdk_db","queue"),this.idbQueue.open().catch((function(){r.idbQueue=null}))),this.loadFromStorage().then((function(){r.opts.flushInterval>0&&r.startTimer()})),this.attachGlobalHandlers(),this.opts.enableAutoPV&&"h5"===this.env&&this.installAutoPV(),this.opts.enablePerf&&"h5"===this.env&&("complete"===document.readyState?this.collectPerf():window.addEventListener("load",(function(){return r.collectPerf()})))}var r,n,o,a,s,l,p;return f()(e,[{key:"logDebug",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this.opts.debug&&(e=console).debug.apply(e,["[LoggerSDK]"].concat(r))}},{key:"loadFromStorage",value:(p=u()(i()().mark((function e(){var t,r;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.storage){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,this.storage.get();case 5:(t=e.sent)&&(r=JSON.parse(t),this.inMemoryQueue=r.concat(this.inMemoryQueue).slice(-this.opts.maxCacheSize),this.logDebug("loaded persisted queue",this.inMemoryQueue.length)),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),this.logDebug("load persisted fail",e.t0);case 12:case"end":return e.stop()}}),e,this,[[2,9]])}))),function(){return p.apply(this,arguments)})},{key:"persistToStorage",value:(l=u()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.storage){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,this.storage.set(g(this.inMemoryQueue));case 5:this.logDebug("persisted queue",this.inMemoryQueue.length),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(2),this.logDebug("persist fail",e.t0);case 11:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(){return l.apply(this,arguments)})},{key:"startTimer",value:function(){var e=this;this.timerId||(this.timerId=setInterval((function(){return e.flush().catch((function(){}))}),this.opts.flushInterval))}},{key:"stopTimer",value:function(){this.timerId&&(clearInterval(this.timerId),this.timerId=null)}},{key:"track",value:(s=u()(i()().mark((function e(t,r){var n;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.closed){e.next=2;break}return e.abrupt("return");case 2:return this.seq+=1,n={type:t.type||"custom",time:t.time||y(),user:t.user||void 0,ctx:t.ctx||{},level:t.level||"info",seq:this.seq},this.inMemoryQueue.push(n),this.logDebug("enqueue",n),e.next=8,this.persistToStorage();case 8:if(!this.idbQueue){e.next=17;break}return e.prev=9,e.next=12,this.idbQueue.add(n);case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(9),this.logDebug("idb add fail",e.t0);case 17:if(!(this.inMemoryQueue.length>=this.opts.batchSize)){e.next=20;break}return e.next=20,this.flush(r).catch((function(){}));case 20:case"end":return e.stop()}}),e,this,[[9,14]])}))),function(e,t){return s.apply(this,arguments)})},{key:"flush",value:(a=u()(i()().mark((function e(r){var n,o,a,s,c,l,f,p,h=this;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.closed){e.next=2;break}return e.abrupt("return");case 2:if(0!==this.inMemoryQueue.length){e.next=4;break}return e.abrupt("return");case 4:if(!this.flushing){e.next=6;break}return e.abrupt("return");case 6:return this.flushing=!0,e.prev=7,n=this.inMemoryQueue.slice(0,this.opts.batchSize),o={},n.forEach((function(e){var t=e.level||"info";(o[t]=o[t]||[]).push(e)})),a=function(e){return new Promise((function(t){return setTimeout(t,e)}))},s=function(e,n){var o=h.opts.endpoints[e]||h.opts.endpoints.default,s={appId:h.opts.appId,env:h.env,ts:y(),level:e,events:n},c=h.opts.retryCount;return function n(l){var f=t()(t()({},h.opts),{},{endpoint:o,headers:t()(t()({},h.opts.globalHeaders||{}),r||{})});return h.opts.transport(s,f).then((function(){return!0})).catch(function(){var t=u()(i()().mark((function t(r){var o,u;return i()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=l+1,h.logDebug("send fail",e,o,r),!(o>c)){t.next=4;break}return t.abrupt("return",!1);case 4:return u=(h.opts.retryBase||300)*Math.pow(2,o-1),t.next=7,a(u);case 7:return t.abrupt("return",n(o));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}(0).then((function(t){return{ok:t,level:e,events:n}}))},e.next=15,Promise.all(Object.keys(o).map((function(e){return s(e,o[e])})));case 15:if(c=e.sent,l=new Set(c.filter((function(e){return e.ok})).map((function(e){return e.level}))),(f=c.length>0&&c.every((function(e){return e.ok})))||0!==l.size){e.next=21;break}return this.logDebug("batch send failed, keep batch in queue"),e.abrupt("return");case 21:return p=new Set(n.filter((function(e){return l.has(e.level||"info")})).map((function(e){return e.seq}))),this.inMemoryQueue=this.inMemoryQueue.filter((function(e){return!p.has(e.seq)})),e.next=25,this.persistToStorage();case 25:if(!f||!this.idbQueue){e.next=34;break}return e.prev=26,e.next=29,this.idbQueue.clear();case 29:e.next=34;break;case 31:e.prev=31,e.t0=e.catch(26),this.logDebug("idb clear fail",e.t0);case 34:return e.prev=34,this.flushing=!1,e.finish(34);case 37:case"end":return e.stop()}}),e,this,[[7,,34,37],[26,31]])}))),function(e){return a.apply(this,arguments)})},{key:"flushAll",value:(o=u()(i()().mark((function e(){var t,r=this;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=0,e.abrupt("return",new Promise((function(e){var n=function(){var o=u()(i()().mark((function o(){return i()().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(t+=1,!(0===r.inMemoryQueue.length||t>=200)){o.next=3;break}return o.abrupt("return",e());case 3:if(r.flushing){o.next=11;break}return o.prev=4,o.next=7,r.flush();case 7:o.next=11;break;case 9:o.prev=9,o.t0=o.catch(4);case 11:setTimeout(n,50);case 12:case"end":return o.stop()}}),o,null,[[4,9]])})));return function(){return o.apply(this,arguments)}}();n()})));case 2:case"end":return e.stop()}}),e)}))),function(){return o.apply(this,arguments)})},{key:"identify",value:(n=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.opts.appId=t&&t.appId||this.opts.appId,this.logDebug("identify",t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setCommon",value:(r=u()(i()().mark((function e(t){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Object.assign(this.opts,t),this.logDebug("setCommon",t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this.stopTimer(),this.closed=!0}},{key:"attachGlobalHandlers",value:function(){var e=this;if("h5"===this.env&&"undefined"!=typeof window){var t=window;t.addEventListener&&t.addEventListener("error",(function(t){try{e.track({type:"error",level:"error",ctx:{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,stack:t.error&&t.error.stack}})}catch(e){}})),t.addEventListener&&t.addEventListener("unhandledrejection",(function(t){try{e.track({type:"error",level:"error",ctx:{reason:t.reason&&(t.reason.stack||t.reason)}})}catch(e){}})),t.addEventListener&&t.addEventListener("error",(function(t){if(t.target&&(t.target.src||t.target.href))try{e.track({type:"error",level:"warn",ctx:{resource:t.target.src||t.target.href,tag:t.target.tagName}})}catch(e){}}),!0),document.addEventListener&&document.addEventListener("visibilitychange",(function(){try{"hidden"===document.visibilityState&&e.flushBeacon()}catch(e){}})),t.addEventListener&&t.addEventListener("pagehide",(function(){try{e.flushBeacon()}catch(e){}})),t.addEventListener&&t.addEventListener("beforeunload",(function(){try{e.flushBeacon()}catch(e){}}))}}},{key:"installAutoPV",value:function(){var e=this;if(b()){var t=window,r=t.history,n=t.location,o=r.pushState,i=r.replaceState,a=function(){try{e.track({type:"pageview",level:"info",ctx:{path:n.pathname+n.search,title:document.title}})}catch(e){}};r.pushState=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];o.apply(this,t),window.dispatchEvent(new Event("locationchange"))},r.replaceState=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.apply(this,t),window.dispatchEvent(new Event("locationchange"))},window.addEventListener("popstate",(function(){return window.dispatchEvent(new Event("locationchange"))})),window.addEventListener("locationchange",a),a()}}},{key:"collectPerf",value:function(){if(b()&&"performance"in window)try{var e=window.performance,t=e.getEntriesByType&&e.getEntriesByType("navigation")&&e.getEntriesByType("navigation")[0],r=e.getEntriesByType?e.getEntriesByType("paint"):[],n={};if(t)n.ttfb=t.responseStart-t.requestStart,n.domContentLoaded=t.domContentLoadedEventEnd-t.startTime,n.load=t.loadEventEnd-t.startTime;else if(e.timing){var o=e.timing;n.ttfb=o.responseStart-o.requestStart,n.domContentLoaded=o.domContentLoadedEventEnd-o.navigationStart,n.load=o.loadEventEnd-o.navigationStart}r&&r.length&&r.forEach((function(e){n[e.name]=e.startTime})),this.track({type:"perf",level:"info",ctx:n})}catch(e){this.logDebug("collect perf fail",e)}}},{key:"flushBeacon",value:function(){var e=this;if(b()&&0!==this.inMemoryQueue.length){var r={};this.inMemoryQueue.forEach((function(e){var t=e.level||"info";(r[t]=r[t]||[]).push(e)})),Object.keys(r).forEach((function(n){var o=r[n],i=e.opts.endpoints[n]||e.opts.endpoints.default,a={appId:e.opts.appId,env:e.env,ts:y(),level:n,events:o},u=t()(t()({},e.opts),{},{endpoint:i,headers:t()({},e.opts.globalHeaders||{}),useBeacon:!0,usePixel:e.opts.usePixel,pixelParam:e.opts.pixelParam,maxPixelUrlLen:e.opts.maxPixelUrlLen});try{e.opts.transport(a,u)}catch(e){}}))}}}]),e}()}(),n}()}));
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@pluve/logger-sdk",
3
+ "version": "0.0.1",
4
+ "description": "logger sdk",
5
+ "keywords": [
6
+ "logger"
7
+ ],
8
+ "author": "黄震 <huangzhen@yfpharmacy.com>",
9
+ "homepage": "http://.",
10
+ "license": "ISC",
11
+ "main": "lib/index.js",
12
+ "types": "lib/index.d.ts",
13
+ "directories": {
14
+ "lib": "lib",
15
+ "dist": "dist"
16
+ },
17
+ "files": [
18
+ "lib/*",
19
+ "dist/*"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public",
23
+ "registry": "https://registry.npmjs.org"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://gitlab.pharmacyyf.com/frontend-common/pluve-lib.git"
28
+ },
29
+ "scripts": {
30
+ "init-install": "npm i",
31
+ "build-types": "tsc",
32
+ "build": "father build",
33
+ "clear-types": "rm -rf lib",
34
+ "clear-build": "rm -rf dist",
35
+ "clear-node_modules": "rm -rf node_modules"
36
+ }
37
+ }