@cimulate/copilot-widget 1.50.2 → 1.50.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.
- package/CHANGELOG.md +9 -0
- package/dist/cimulate-copilot-widget.d.ts +6 -0
- package/dist/cimulate-copilot-widget.es.js +1280 -1277
- package/dist/cimulate-copilot-widget.umd.js +16 -16
- package/dist/copilot.es.js +1280 -1277
- package/dist/copilot.umd.js +16 -16
- package/dist/messaging.d.ts +6 -0
- package/dist/messaging.es.js +5815 -5834
- package/dist/messaging.umd.js +45 -48
- package/dist/o11y-sdk.umd.js +4 -0
- package/package.json +1 -1
- package/dist/client-BjHA3vv5.js +0 -1964
- package/dist/collectors-DLVG7H_C.js +0 -2053
- package/dist/sf_embeddedMessaging-B3h7hoYD.js +0 -18
- package/dist/shared-B0BNUnWB.js +0 -661
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const e = { namespace: "sf.embeddedMessaging", name: "FailureEvent", pbjsSchema: { nested: { sf: { nested: { embeddedMessaging: { nested: { FailureEvent: { oneofs: { _participantType: { oneof: ["participantType"] }, _convEntryId: { oneof: ["convEntryId"] } }, fields: { convId: { id: 4, type: "string" }, method: { id: 2, type: "string" }, clientName: { id: 10, type: "string" }, errCode: { id: 5, type: "uint32" }, jwtClaims: { id: 8, type: "string" }, participantType: {
|
|
2
|
-
options: { proto3_optional: !0 },
|
|
3
|
-
id: 11,
|
|
4
|
-
type: "string"
|
|
5
|
-
}, hostUrl: { id: 9, type: "string" }, convType: { id: 7, type: "string" }, errMessage: { id: 3, type: "string" }, configDev: { id: 1, type: "string" }, convEntryId: { options: { proto3_optional: !0 }, id: 6, type: "string" } } } } } } } } } }, t = { namespace: "sf.embeddedMessaging", name: "InteractionEvent", pbjsSchema: { nested: { sf: { nested: { embeddedMessaging: { nested: { InteractionEvent: { oneofs: { _participantType: { oneof: ["participantType"] } }, fields: { convId: { id: 5, type: "string" }, op: { id: 4, type: "string" }, method: { id: 2, type: "string" }, feature: { id: 3, type: "string" }, fileSize: { id: 6, type: "uint32" }, clientName: { id: 11, type: "string" }, jwtClaims: { id: 9, type: "string" }, participantType: {
|
|
6
|
-
options: { proto3_optional: !0 },
|
|
7
|
-
id: 12,
|
|
8
|
-
type: "string"
|
|
9
|
-
}, fileMimeType: { id: 7, type: "string" }, hostUrl: { id: 10, type: "string" }, convType: { id: 8, type: "string" }, configDev: { id: 1, type: "string" } } } } } } } } } }, n = { namespace: "sf.embeddedMessaging", name: "CurrentState", pbjsSchema: { nested: { sf: { nested: { embeddedMessaging: { nested: { CurrentState: { oneofs: { _participantType: { oneof: ["participantType"] }, _convEntryId: { oneof: ["convEntryId"] } }, fields: { convId: { id: 4, type: "string" }, method: { id: 2, type: "string" }, clientName: { id: 9, type: "string" }, jwtClaims: { id: 7, type: "string" }, stateMessage: { id: 3, type: "string" }, participantType: {
|
|
10
|
-
options: { proto3_optional: !0 },
|
|
11
|
-
id: 10,
|
|
12
|
-
type: "string"
|
|
13
|
-
}, hostUrl: { id: 8, type: "string" }, convType: { id: 6, type: "string" }, configDev: { id: 1, type: "string" }, convEntryId: { options: { proto3_optional: !0 }, id: 5, type: "string" } } } } } } } } } };
|
|
14
|
-
export {
|
|
15
|
-
n as currentStateSchema,
|
|
16
|
-
e as failureEventSchema,
|
|
17
|
-
t as interactionEventSchema
|
|
18
|
-
};
|
package/dist/shared-B0BNUnWB.js
DELETED
|
@@ -1,661 +0,0 @@
|
|
|
1
|
-
class g {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.notImplemented = "Method not implemented.";
|
|
4
|
-
const e = typeof performance != "undefined";
|
|
5
|
-
e ? performance.timeOrigin ? this._timeOrigin = performance.timeOrigin : this._timeOrigin = Date.now() : this._timeOrigin = Date.now();
|
|
6
|
-
const n = this._timeOrigin;
|
|
7
|
-
e && typeof performance.now == "function" ? (this.perfNow = performance.now.bind(performance), this.time = () => {
|
|
8
|
-
const t = this.perfNow();
|
|
9
|
-
return { tsNow: n + t, perfNow: t, timeOrigin: n };
|
|
10
|
-
}) : (this.perfNow = () => Date.now() - n, this.time = () => {
|
|
11
|
-
const t = this.perfNow();
|
|
12
|
-
return { tsNow: Date.now(), perfNow: t, timeOrigin: n };
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
get isProduction() {
|
|
16
|
-
return g._isProduction;
|
|
17
|
-
}
|
|
18
|
-
markProduction(e) {
|
|
19
|
-
g._isProduction = e != null ? e : !0;
|
|
20
|
-
}
|
|
21
|
-
_checkArgument(e, n) {
|
|
22
|
-
if (typeof n == "string")
|
|
23
|
-
return typeof e === n;
|
|
24
|
-
if (typeof n == "function")
|
|
25
|
-
return e instanceof n;
|
|
26
|
-
if (Array.isArray(n))
|
|
27
|
-
return n.some((t) => this._checkArgument(e, t));
|
|
28
|
-
throw new Error(`Invalid argKind ${n}`);
|
|
29
|
-
}
|
|
30
|
-
requireArgument(e, n, t) {
|
|
31
|
-
let r = e == null || e === "";
|
|
32
|
-
const s = t !== void 0;
|
|
33
|
-
if (!r && s && (r = !this._checkArgument(e, t)), r)
|
|
34
|
-
throw new Error(`${n} argument is required${s ? " and must be of a supported type." : "."}`);
|
|
35
|
-
}
|
|
36
|
-
requireArgumentIfDefined(e, n, t) {
|
|
37
|
-
if (e === void 0)
|
|
38
|
-
return !1;
|
|
39
|
-
if (e === null || e === "" || !this._checkArgument(e, t))
|
|
40
|
-
throw new Error(`${n} argument, if defined, must be of a supported type.`);
|
|
41
|
-
return !0;
|
|
42
|
-
}
|
|
43
|
-
checkForDenyListedValues(e, n, t) {
|
|
44
|
-
if (t.some((r) => e === r))
|
|
45
|
-
throw new Error(`The value ${e} isn't allowed for ${n} argument.`);
|
|
46
|
-
}
|
|
47
|
-
checkForReservedCharacters(e, n, t) {
|
|
48
|
-
if (e && t.some((r) => e.indexOf(r) >= 0))
|
|
49
|
-
throw new Error(`The argument ${n} isn't allowed to contain characters from ['${t.join(", ")}']. Received: ${e}.`);
|
|
50
|
-
}
|
|
51
|
-
generateUniqueId(e = 16) {
|
|
52
|
-
const n = [], t = "0123456789abcdef";
|
|
53
|
-
if (!(e === void 0 || e > 0))
|
|
54
|
-
throw new Error('If specified, the argument "length" must be a positive integer');
|
|
55
|
-
for (let r = 0; r < e; r++) {
|
|
56
|
-
const s = Math.floor(Math.random() * 16);
|
|
57
|
-
n.push(t[s]);
|
|
58
|
-
}
|
|
59
|
-
return n.join("");
|
|
60
|
-
}
|
|
61
|
-
getXpath(e) {
|
|
62
|
-
function n(s) {
|
|
63
|
-
const i = s.localName;
|
|
64
|
-
for (; s.nextElementSibling; )
|
|
65
|
-
if (s = s.nextElementSibling, s.localName === i)
|
|
66
|
-
return !0;
|
|
67
|
-
return !1;
|
|
68
|
-
}
|
|
69
|
-
function t(s, i) {
|
|
70
|
-
return s ? t(s.previousElementSibling, i || s.localName) + (s.localName === i ? 1 : 0) : 1;
|
|
71
|
-
}
|
|
72
|
-
function r(s) {
|
|
73
|
-
if (!s || s.nodeType !== 1)
|
|
74
|
-
return [""];
|
|
75
|
-
const i = t(s) > 1 || n(s) ? `${s.localName.toLowerCase()}[${t(s)}]` : s.localName.toLowerCase();
|
|
76
|
-
return [...r(s.parentNode), i];
|
|
77
|
-
}
|
|
78
|
-
return r(e).join("/");
|
|
79
|
-
}
|
|
80
|
-
getAge(e) {
|
|
81
|
-
return e - this._timeOrigin;
|
|
82
|
-
}
|
|
83
|
-
_getNavigatorSafe() {
|
|
84
|
-
try {
|
|
85
|
-
return typeof navigator != "undefined" ? navigator : void 0;
|
|
86
|
-
} catch (e) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
_hasEffectiveConnectionType(e) {
|
|
91
|
-
if (typeof e != "object" || e === null || !("connection" in e))
|
|
92
|
-
return !1;
|
|
93
|
-
const n = e.connection;
|
|
94
|
-
return typeof n == "object" && n !== null && "effectiveType" in n && typeof n.effectiveType == "string";
|
|
95
|
-
}
|
|
96
|
-
getConnectionType() {
|
|
97
|
-
const e = this._getNavigatorSafe();
|
|
98
|
-
return this._hasEffectiveConnectionType(e) ? e.connection.effectiveType : void 0;
|
|
99
|
-
}
|
|
100
|
-
clone(e) {
|
|
101
|
-
return JSON.parse(JSON.stringify(e));
|
|
102
|
-
}
|
|
103
|
-
definedValueOrDefault(e, n) {
|
|
104
|
-
return e !== void 0 ? e : n;
|
|
105
|
-
}
|
|
106
|
-
getGlobal() {
|
|
107
|
-
if (typeof globalThis == "object")
|
|
108
|
-
return globalThis;
|
|
109
|
-
if (typeof self == "object")
|
|
110
|
-
return self;
|
|
111
|
-
throw new Error("Unable to locate globalThis or self");
|
|
112
|
-
}
|
|
113
|
-
getIsBeaconSupported() {
|
|
114
|
-
const e = this.getGlobal(), n = this._getNavigatorSafe();
|
|
115
|
-
return typeof (n == null ? void 0 : n.sendBeacon) == "function" && typeof e.Blob == "function";
|
|
116
|
-
}
|
|
117
|
-
estimateObjectSize(e) {
|
|
118
|
-
const n = /* @__PURE__ */ new Set(), t = [e];
|
|
119
|
-
let r = 0;
|
|
120
|
-
for (; t.length; ) {
|
|
121
|
-
const s = t.pop();
|
|
122
|
-
if (typeof s == "boolean")
|
|
123
|
-
r += 4;
|
|
124
|
-
else if (typeof s == "string")
|
|
125
|
-
r += s.length * 2;
|
|
126
|
-
else if (typeof s == "number")
|
|
127
|
-
r += 8;
|
|
128
|
-
else if (s instanceof Uint8Array || s instanceof Uint8ClampedArray || s instanceof Uint16Array || s instanceof Uint32Array || s instanceof Int8Array || s instanceof Int16Array || s instanceof Int32Array || s instanceof Float32Array || s instanceof Float64Array)
|
|
129
|
-
r += s.byteLength;
|
|
130
|
-
else if (typeof s == "object") {
|
|
131
|
-
const i = s;
|
|
132
|
-
if (!n.has(i)) {
|
|
133
|
-
n.add(i);
|
|
134
|
-
for (const o in i)
|
|
135
|
-
t.push(i[o]);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return r;
|
|
140
|
-
}
|
|
141
|
-
noProdThrow(e) {
|
|
142
|
-
if (!d.isProduction)
|
|
143
|
-
throw e;
|
|
144
|
-
}
|
|
145
|
-
isAllowedOrigin(e, n) {
|
|
146
|
-
return Array.isArray(n) && n.some((t) => t === "*" || e === t || t instanceof RegExp && t.test(e));
|
|
147
|
-
}
|
|
148
|
-
roundNumber(e, n) {
|
|
149
|
-
const t = Math.pow(10, n);
|
|
150
|
-
return Math.round(e * t) / t;
|
|
151
|
-
}
|
|
152
|
-
roundNumbersInObject(e, n) {
|
|
153
|
-
e && Object.entries(e).forEach(([t, r]) => {
|
|
154
|
-
typeof r == "number" && (e[t] = this.roundNumber(r, n));
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
tryGetAbsoluteUrl(e) {
|
|
158
|
-
var n, t;
|
|
159
|
-
return e != null && e.startsWith("//") && typeof window == "object" ? ((n = window.location.protocol) !== null && n !== void 0 ? n : "") + e : e != null && e.startsWith("/") && typeof window == "object" ? ((t = window.location.origin) !== null && t !== void 0 ? t : "") + e : e;
|
|
160
|
-
}
|
|
161
|
-
validateParentActivityType(e, n) {
|
|
162
|
-
const t = e != null ? e : !1;
|
|
163
|
-
if (!n)
|
|
164
|
-
return;
|
|
165
|
-
const r = n.isExternal();
|
|
166
|
-
if (t === r)
|
|
167
|
-
return n;
|
|
168
|
-
{
|
|
169
|
-
const s = t ? "external" : "internal", i = r ? "external" : "internal";
|
|
170
|
-
throw new Error(`Parent activity type mismatch: ${s} activity cannot have ${i} parent.`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
g._isProduction = !0;
|
|
175
|
-
const y = new g(), m = y.getGlobal();
|
|
176
|
-
y.markProduction(m == null ? void 0 : m.__O11Y_IS_PROD__);
|
|
177
|
-
const d = Object.freeze(y);
|
|
178
|
-
class C {
|
|
179
|
-
constructor(e, n, t, r, s, i, o) {
|
|
180
|
-
this._name = e, this._ownerName = n, this._ownerAppName = t, this._tags = r, this._value = 0, this._createdOn = s === void 0 ? d.time().tsNow : s, i !== void 0 && (this._lastUpdatedOn = i), o !== void 0 && (this._value = o);
|
|
181
|
-
}
|
|
182
|
-
getName() {
|
|
183
|
-
return this._name;
|
|
184
|
-
}
|
|
185
|
-
getCreatedOn() {
|
|
186
|
-
return this._createdOn;
|
|
187
|
-
}
|
|
188
|
-
getLastUpdatedOn() {
|
|
189
|
-
return this._lastUpdatedOn;
|
|
190
|
-
}
|
|
191
|
-
getData() {
|
|
192
|
-
return this._value;
|
|
193
|
-
}
|
|
194
|
-
increment(e = 1) {
|
|
195
|
-
if (typeof e == "number" && e > 0) {
|
|
196
|
-
this._value += Math.round(e), this._lastUpdatedOn = d.time().tsNow;
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
throw new Error("UpCounter can only increment positive numbers.");
|
|
200
|
-
}
|
|
201
|
-
reset() {
|
|
202
|
-
this._lastUpdatedOn = void 0, this._value = 0;
|
|
203
|
-
}
|
|
204
|
-
getOwnerName() {
|
|
205
|
-
return this._ownerName;
|
|
206
|
-
}
|
|
207
|
-
getOwnerAppName() {
|
|
208
|
-
return this._ownerAppName;
|
|
209
|
-
}
|
|
210
|
-
getTags() {
|
|
211
|
-
return this._tags;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
const T = "co11y";
|
|
215
|
-
class x {
|
|
216
|
-
constructor() {
|
|
217
|
-
this._upCounters = /* @__PURE__ */ new Map(), this._ownerAppName = T;
|
|
218
|
-
}
|
|
219
|
-
_addOrUpdateCounter(e, n, t) {
|
|
220
|
-
if (!e)
|
|
221
|
-
return;
|
|
222
|
-
const r = { status: t }, s = `${this._ownerAppName}:${n}:${e}${JSON.stringify(r)}`;
|
|
223
|
-
let i = this._upCounters.get(s);
|
|
224
|
-
i || (i = new C(e, n, this._ownerAppName, r), this._upCounters.set(s, i)), i.increment();
|
|
225
|
-
}
|
|
226
|
-
success(e, n) {
|
|
227
|
-
this._addOrUpdateCounter(e, n, "success");
|
|
228
|
-
}
|
|
229
|
-
exception(e, n) {
|
|
230
|
-
this._addOrUpdateCounter(e, n, "error");
|
|
231
|
-
}
|
|
232
|
-
getBucketHistograms() {
|
|
233
|
-
return [];
|
|
234
|
-
}
|
|
235
|
-
getUpCounters() {
|
|
236
|
-
return Array.from(this._upCounters.values()).filter((e) => e.getLastUpdatedOn());
|
|
237
|
-
}
|
|
238
|
-
getValueRecorders() {
|
|
239
|
-
return [];
|
|
240
|
-
}
|
|
241
|
-
setOwnerAppName(e) {
|
|
242
|
-
this._ownerAppName = e;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
const w = new x();
|
|
246
|
-
class q {
|
|
247
|
-
constructor(e) {
|
|
248
|
-
if (this._lazyMap = /* @__PURE__ */ new Map(), e !== void 0) {
|
|
249
|
-
if (typeof e == "number" && e > 0) {
|
|
250
|
-
this._maxSize = Math.ceil(e);
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
throw new Error("maxSize must be a positive number");
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
get maxSize() {
|
|
257
|
-
return this._maxSize;
|
|
258
|
-
}
|
|
259
|
-
get size() {
|
|
260
|
-
return this._lazyMap.size;
|
|
261
|
-
}
|
|
262
|
-
push(e, n) {
|
|
263
|
-
let t = this._lazyMap.get(e);
|
|
264
|
-
if (!t) {
|
|
265
|
-
if (this.maxSize !== void 0 && this.size === this.maxSize)
|
|
266
|
-
return !1;
|
|
267
|
-
t = new Array(), this._lazyMap.set(e, t);
|
|
268
|
-
}
|
|
269
|
-
return t.push(n), !0;
|
|
270
|
-
}
|
|
271
|
-
getMessages(e, n) {
|
|
272
|
-
const t = this._lazyMap.get(e);
|
|
273
|
-
return n && this._lazyMap.has(e) && this._lazyMap.set(e, []), t || [];
|
|
274
|
-
}
|
|
275
|
-
getAllMessages(e) {
|
|
276
|
-
const n = /* @__PURE__ */ new Map();
|
|
277
|
-
for (const [t, r] of this._lazyMap.entries())
|
|
278
|
-
r.length && n.set(t, this.getMessages(t, e));
|
|
279
|
-
return n;
|
|
280
|
-
}
|
|
281
|
-
extractMessages(e) {
|
|
282
|
-
return this.getMessages(e, !0);
|
|
283
|
-
}
|
|
284
|
-
extractAllMessages() {
|
|
285
|
-
return this.getAllMessages(!0);
|
|
286
|
-
}
|
|
287
|
-
get totalItemCount() {
|
|
288
|
-
let e = 0;
|
|
289
|
-
for (const n of this._lazyMap.values())
|
|
290
|
-
e += n.length;
|
|
291
|
-
return e;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
class I {
|
|
295
|
-
getSchemaId(e) {
|
|
296
|
-
return `${e.namespace}.${e.name}`;
|
|
297
|
-
}
|
|
298
|
-
isInternal(e) {
|
|
299
|
-
return (e == null ? void 0 : e.namespace) === "sf.instrumentation";
|
|
300
|
-
}
|
|
301
|
-
makePayload(e, n, t = !0) {
|
|
302
|
-
if (!t || e !== void 0 && n !== void 0)
|
|
303
|
-
return {
|
|
304
|
-
schema: e,
|
|
305
|
-
payload: n
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
checkSchema(e) {
|
|
309
|
-
return d.requireArgument(e, "schema", "object"), d.requireArgument(e.namespace, "schema.namespace", "string"), d.requireArgument(e.name, "schema.name", "string"), d.requireArgument(e.pbjsSchema, "schema.pbjsSchema", "object"), this._getTokens(e);
|
|
310
|
-
}
|
|
311
|
-
_getTokens(e) {
|
|
312
|
-
const n = e.namespace.split(".");
|
|
313
|
-
if (n.length !== 2)
|
|
314
|
-
throw new Error(`Schema "${this.getSchemaId(e)}" must have a namespace of the form "domain.feature".`);
|
|
315
|
-
return {
|
|
316
|
-
domain: n[0],
|
|
317
|
-
feature: n[1],
|
|
318
|
-
message: e.name
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
_getAnyNestedObject(e, n) {
|
|
322
|
-
return n.reduce((t, r) => {
|
|
323
|
-
const s = t.nested;
|
|
324
|
-
if (s) {
|
|
325
|
-
const i = s[r];
|
|
326
|
-
if (i)
|
|
327
|
-
return i;
|
|
328
|
-
}
|
|
329
|
-
throw new Error(`Cannot locate ${n.join(".")} in schema with ID ${this.getSchemaId(e)}`);
|
|
330
|
-
}, e.pbjsSchema);
|
|
331
|
-
}
|
|
332
|
-
getTypes(e) {
|
|
333
|
-
const n = this.checkSchema(e), r = this._getAnyNestedObject(e, [
|
|
334
|
-
n.domain,
|
|
335
|
-
n.feature
|
|
336
|
-
]).nested;
|
|
337
|
-
if (!r)
|
|
338
|
-
throw new Error(`Cannot parse schema with ID ${this.getSchemaId(e)}`);
|
|
339
|
-
return r;
|
|
340
|
-
}
|
|
341
|
-
getType(e, n) {
|
|
342
|
-
d.requireArgument(n, "messageName", "string");
|
|
343
|
-
const r = this.getTypes(e)[n];
|
|
344
|
-
if (!r)
|
|
345
|
-
throw new Error(`Cannot locate message ${n} in schema with ID ${this.getSchemaId(e)}`);
|
|
346
|
-
return r;
|
|
347
|
-
}
|
|
348
|
-
getOptions(e, n, t) {
|
|
349
|
-
t && d.requireArgument(n, "messageName", "string");
|
|
350
|
-
const r = this.checkSchema(e);
|
|
351
|
-
if (!n)
|
|
352
|
-
return this._getAnyNestedObject(e, [
|
|
353
|
-
r.domain,
|
|
354
|
-
r.feature
|
|
355
|
-
]).options;
|
|
356
|
-
const s = this.getType(e, n);
|
|
357
|
-
if (!t)
|
|
358
|
-
return s.options;
|
|
359
|
-
const i = s.fields[t];
|
|
360
|
-
if (!i) {
|
|
361
|
-
const o = this.getSchemaId(e);
|
|
362
|
-
throw new Error(`Cannot locate field ${t} in message ${n} in schema with ID ${o}`);
|
|
363
|
-
}
|
|
364
|
-
return i.options;
|
|
365
|
-
}
|
|
366
|
-
getExtraFields(e, n) {
|
|
367
|
-
const { message: t } = this._getTokens(e), s = this.getTypes(e)[t].fields, i = new Set(Object.keys(s));
|
|
368
|
-
return n != null ? Object.keys(n).filter((f) => !i.has(f)) : [];
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
const h = new I(), N = 1e4, O = 1e4, _ = 0, E = 2147483647, M = -2147483648, $ = 4294967295, j = 9223372036854776e3, U = -9223372036854776e3, F = 18446744073709552e3;
|
|
372
|
-
class b {
|
|
373
|
-
constructor(e, n, t, r) {
|
|
374
|
-
this.errorCode = e, this.fields = n, this.expected = t, this.received = r;
|
|
375
|
-
}
|
|
376
|
-
asMessage(e) {
|
|
377
|
-
const n = this.fields[0] + this.fields.slice(1).reduce((r, s) => Number(s) >= 0 ? `${r}[${s}]` : `${r}.${s}`, "");
|
|
378
|
-
let t;
|
|
379
|
-
switch (this.errorCode) {
|
|
380
|
-
case 1:
|
|
381
|
-
t = "Repeated field must be an array";
|
|
382
|
-
break;
|
|
383
|
-
case 2:
|
|
384
|
-
t = `Expected type ${this.expected} but received type ${this.received}`;
|
|
385
|
-
break;
|
|
386
|
-
case 3:
|
|
387
|
-
t = "Value must be finite";
|
|
388
|
-
break;
|
|
389
|
-
case 4:
|
|
390
|
-
t = "Value is out of range for its type";
|
|
391
|
-
break;
|
|
392
|
-
case 5:
|
|
393
|
-
t = "Bytes array is malformed";
|
|
394
|
-
break;
|
|
395
|
-
case 6:
|
|
396
|
-
t = "Exceeded app limit for maximum string length";
|
|
397
|
-
break;
|
|
398
|
-
case 7:
|
|
399
|
-
t = "Exceeded app limit for item count";
|
|
400
|
-
break;
|
|
401
|
-
case 12:
|
|
402
|
-
t = "Value must be an integer";
|
|
403
|
-
break;
|
|
404
|
-
case 13:
|
|
405
|
-
t = "Values like null or undefined are not allowed for items in repeated fields";
|
|
406
|
-
break;
|
|
407
|
-
default:
|
|
408
|
-
t = `Unknown error code: ${this.errorCode}`;
|
|
409
|
-
break;
|
|
410
|
-
}
|
|
411
|
-
return `Schema ${e} on field "${n}": ${t}`;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
class P {
|
|
415
|
-
validate(e, n, t = !1) {
|
|
416
|
-
const r = h.checkSchema(e);
|
|
417
|
-
d.requireArgument(n, "data", "object");
|
|
418
|
-
const s = h.getSchemaId(e), i = new Array(), o = h.getTypes(e);
|
|
419
|
-
if (this._validateFields(i, [], n, o[r.message], o, s), i.length && !t)
|
|
420
|
-
throw new Error(i[0].asMessage(s));
|
|
421
|
-
return i;
|
|
422
|
-
}
|
|
423
|
-
_validateFields(e, n, t, r, s, i) {
|
|
424
|
-
const o = r.oneofs || {}, f = r.fields || {};
|
|
425
|
-
for (const c in t) {
|
|
426
|
-
const u = t[c];
|
|
427
|
-
if (u != null) {
|
|
428
|
-
const a = (l, S, k) => this._matchFieldTypes(e, [...n, c], u, l, s, i, c, S, k);
|
|
429
|
-
o[c] ? a(f[o[c].oneof[0]].type) : f[c] && a(f[c].type, f[c].rule === "repeated");
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
_matchFieldTypes(e, n, t, r, s, i, o, f, c) {
|
|
434
|
-
let u;
|
|
435
|
-
if (f)
|
|
436
|
-
Array.isArray(t) ? (t.length > O && (u = 7), t.forEach((a, l) => {
|
|
437
|
-
this._matchFieldTypes(e, [...n, l.toString()], a, r, s, i, o, void 0, !0);
|
|
438
|
-
})) : u = 1;
|
|
439
|
-
else if (t == null || t === void 0)
|
|
440
|
-
c && (u = 13);
|
|
441
|
-
else {
|
|
442
|
-
let a, l;
|
|
443
|
-
switch (r) {
|
|
444
|
-
case "string":
|
|
445
|
-
l = "string", t.length > N && (u = 6);
|
|
446
|
-
break;
|
|
447
|
-
case "bytes":
|
|
448
|
-
l = "object", t instanceof Uint8Array || (u = 5);
|
|
449
|
-
break;
|
|
450
|
-
case "bool":
|
|
451
|
-
l = "boolean";
|
|
452
|
-
break;
|
|
453
|
-
case "uint32":
|
|
454
|
-
l = "number", a = {
|
|
455
|
-
min: _,
|
|
456
|
-
max: $,
|
|
457
|
-
isInt: !0,
|
|
458
|
-
isItem: c
|
|
459
|
-
};
|
|
460
|
-
break;
|
|
461
|
-
case "int32":
|
|
462
|
-
case "sint32":
|
|
463
|
-
case "fixed32":
|
|
464
|
-
case "sfixed32":
|
|
465
|
-
l = "number", a = {
|
|
466
|
-
min: M,
|
|
467
|
-
max: E,
|
|
468
|
-
isInt: !0,
|
|
469
|
-
isItem: c
|
|
470
|
-
};
|
|
471
|
-
break;
|
|
472
|
-
case "uint64":
|
|
473
|
-
l = "number", a = {
|
|
474
|
-
min: _,
|
|
475
|
-
max: F,
|
|
476
|
-
isInt: !0,
|
|
477
|
-
isItem: c
|
|
478
|
-
};
|
|
479
|
-
break;
|
|
480
|
-
case "fixed64":
|
|
481
|
-
case "sfixed64":
|
|
482
|
-
case "int64":
|
|
483
|
-
case "sint64":
|
|
484
|
-
l = "number", a = {
|
|
485
|
-
min: U,
|
|
486
|
-
max: j,
|
|
487
|
-
isInt: !0,
|
|
488
|
-
isItem: c
|
|
489
|
-
};
|
|
490
|
-
break;
|
|
491
|
-
case "double":
|
|
492
|
-
case "float":
|
|
493
|
-
l = "number", a = {
|
|
494
|
-
min: Number.NEGATIVE_INFINITY,
|
|
495
|
-
max: Number.POSITIVE_INFINITY,
|
|
496
|
-
isInt: !1,
|
|
497
|
-
isItem: c
|
|
498
|
-
};
|
|
499
|
-
break;
|
|
500
|
-
default:
|
|
501
|
-
new Set(Object.keys(s)).has(r) && (this._validateFields(e, n, t, s[r], s, i), l = "object");
|
|
502
|
-
break;
|
|
503
|
-
}
|
|
504
|
-
typeof t !== l ? e.push(new b(2, n, r, typeof t)) : a && (a.isInt && !Number.isFinite(t) ? u = 3 : a.isInt && !Number.isInteger(t) ? u = 12 : !(!a.isInt && Number.isNaN(t)) && !(t >= a.min && t <= a.max) && (u = 4));
|
|
505
|
-
}
|
|
506
|
-
u && e.push(new b(u, n));
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
const v = new P();
|
|
510
|
-
class z {
|
|
511
|
-
_getMetricTags(e) {
|
|
512
|
-
const n = e.getTags();
|
|
513
|
-
if (n)
|
|
514
|
-
return Object.entries(n).map((t) => ({
|
|
515
|
-
name: t[0],
|
|
516
|
-
value: t[1].toString()
|
|
517
|
-
}));
|
|
518
|
-
}
|
|
519
|
-
getUpCounters(e, n = !0) {
|
|
520
|
-
return e.map((t) => {
|
|
521
|
-
const r = {
|
|
522
|
-
name: t.getName(),
|
|
523
|
-
createdTimestamp: t.getCreatedOn(),
|
|
524
|
-
lastUpdatedTimestamp: t.getLastUpdatedOn(),
|
|
525
|
-
value: t.getData(),
|
|
526
|
-
ownerName: t.getOwnerName(),
|
|
527
|
-
ownerAppName: t.getOwnerAppName(),
|
|
528
|
-
tags: this._getMetricTags(t)
|
|
529
|
-
};
|
|
530
|
-
return n && t.reset(), r;
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
getValueRecorders(e, n = !0) {
|
|
534
|
-
return e.map((t) => {
|
|
535
|
-
const r = {
|
|
536
|
-
name: t.getName(),
|
|
537
|
-
createdTimestamp: t.getCreatedOn(),
|
|
538
|
-
lastUpdatedTimestamp: t.getLastUpdatedOn(),
|
|
539
|
-
values: t.getData(),
|
|
540
|
-
ownerName: t.getOwnerName(),
|
|
541
|
-
ownerAppName: t.getOwnerAppName(),
|
|
542
|
-
tags: this._getMetricTags(t)
|
|
543
|
-
};
|
|
544
|
-
return n && t.reset(), r;
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
getBucketHistograms(e, n = !0) {
|
|
548
|
-
return e.map((t) => {
|
|
549
|
-
const r = {
|
|
550
|
-
name: t.getName(),
|
|
551
|
-
createdTimestamp: t.getCreatedOn(),
|
|
552
|
-
lastUpdatedTimestamp: t.getLastUpdatedOn(),
|
|
553
|
-
values: t.getData(),
|
|
554
|
-
buckets: t.getBuckets(),
|
|
555
|
-
ownerName: t.getOwnerName(),
|
|
556
|
-
ownerAppName: t.getOwnerAppName(),
|
|
557
|
-
tags: this._getMetricTags(t)
|
|
558
|
-
};
|
|
559
|
-
return n && t.reset(), r;
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
getMetricsTags(e) {
|
|
563
|
-
const n = {};
|
|
564
|
-
return e.forEach((t) => {
|
|
565
|
-
n[t.name] = t.value;
|
|
566
|
-
}), n;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
const B = Object.freeze(new z());
|
|
570
|
-
class L {
|
|
571
|
-
checkInputs(e, n) {
|
|
572
|
-
h.checkSchema(e), d.requireArgument(n, "data", "object");
|
|
573
|
-
let t, r;
|
|
574
|
-
n.userPayload !== void 0 && h.isInternal(e) && (r = n.userPayload, t = v.validate(r.schema, r.payload, !0), this._processValidationResults(h.getSchemaId(r.schema), r.payload, t), n.userPayload = void 0), t = v.validate(e, n, !0), this._processValidationResults(h.getSchemaId(e), n, t), r !== void 0 && (n.userPayload = r);
|
|
575
|
-
}
|
|
576
|
-
getExtraFields(e, n) {
|
|
577
|
-
d.requireArgument(n, "data", "object");
|
|
578
|
-
const t = [], r = n.userPayload;
|
|
579
|
-
return r !== void 0 && h.isInternal(e) && t.push(...h.getExtraFields(r.schema, r.payload)), t.push(...h.getExtraFields(e, n)), t;
|
|
580
|
-
}
|
|
581
|
-
getPayloadFromProvider(e, n) {
|
|
582
|
-
const t = (e == null ? void 0 : e.getPayload(n)) || void 0;
|
|
583
|
-
return t && this.checkInputs(t.schema, t.payload), t;
|
|
584
|
-
}
|
|
585
|
-
_processValidationResults(e, n, t) {
|
|
586
|
-
for (let r = 0; r < t.length; r += 1) {
|
|
587
|
-
const s = t[r];
|
|
588
|
-
if (s.errorCode == 6 || s.errorCode == 7) {
|
|
589
|
-
const i = s.fields.length - 1, o = this._traverseFields(n, s.fields.slice(0, i)), f = s.fields[i];
|
|
590
|
-
s.errorCode == 6 ? o[f] = o[f].substring(0, N) : o[f].splice(O);
|
|
591
|
-
} else
|
|
592
|
-
throw new Error(s.asMessage(e));
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
_traverseFields(e, n) {
|
|
596
|
-
return n.length ? this._traverseFields(e[n[0]], n.slice(1)) : e;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
const R = Object.freeze(new L()), A = "o11y";
|
|
600
|
-
class G {
|
|
601
|
-
constructor(e) {
|
|
602
|
-
this._errorCounter = e, this._safeCatchMode = !1;
|
|
603
|
-
}
|
|
604
|
-
_callCo11y(e, n) {
|
|
605
|
-
n ? w.exception(e == null ? void 0 : e.op, A) : w.success(e == null ? void 0 : e.op, A);
|
|
606
|
-
}
|
|
607
|
-
tryCatch(e, n) {
|
|
608
|
-
let t;
|
|
609
|
-
try {
|
|
610
|
-
e();
|
|
611
|
-
} catch (r) {
|
|
612
|
-
t = !0, this._prodSafeCatch(r);
|
|
613
|
-
} finally {
|
|
614
|
-
this._callCo11y(n, t);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
tryCatchReturn(e, n, t) {
|
|
618
|
-
let r;
|
|
619
|
-
try {
|
|
620
|
-
return d.requireArgument(n, "noopValue"), e();
|
|
621
|
-
} catch (s) {
|
|
622
|
-
return r = !0, this._prodSafeCatch(s), n;
|
|
623
|
-
} finally {
|
|
624
|
-
this._callCo11y(t, r);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
_prodSafeCatch(e) {
|
|
628
|
-
let n;
|
|
629
|
-
try {
|
|
630
|
-
if (n = !d.isProduction, n)
|
|
631
|
-
throw e;
|
|
632
|
-
if (this._safeCatchMode)
|
|
633
|
-
throw this._safeCatchMode = !1, new Error("Internal error in prodSafeCatch.");
|
|
634
|
-
if (this._safeCatchMode = !0, this._errorCounter && this._errorCounter.increment(), !(e instanceof Error)) {
|
|
635
|
-
const t = e && e.message || (typeof e.toString == "function" ? e.toString() : "");
|
|
636
|
-
e = new Error(t);
|
|
637
|
-
}
|
|
638
|
-
this._safeCatchMode = !1;
|
|
639
|
-
} catch (t) {
|
|
640
|
-
if (n)
|
|
641
|
-
throw t;
|
|
642
|
-
if (t && console && typeof console.error == "function")
|
|
643
|
-
try {
|
|
644
|
-
console.error(t);
|
|
645
|
-
} catch (r) {
|
|
646
|
-
}
|
|
647
|
-
this._safeCatchMode = !1;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
export {
|
|
652
|
-
q as L,
|
|
653
|
-
G as P,
|
|
654
|
-
C as U,
|
|
655
|
-
N as a,
|
|
656
|
-
w as c,
|
|
657
|
-
B as m,
|
|
658
|
-
R as p,
|
|
659
|
-
h as s,
|
|
660
|
-
d as u
|
|
661
|
-
};
|