@sailfish-ai/sf-veritas 0.1.35 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/funcSpanTransformer-CTddGtUV.cjs +1 -0
- package/dist/funcSpanTransformer-coYDqcrs.js +136 -0
- package/dist/plugins/funcspanEsbuildPlugin.cjs +1 -0
- package/dist/plugins/funcspanEsbuildPlugin.mjs +21 -0
- package/dist/plugins/funcspanRollupPlugin.cjs +1 -0
- package/dist/plugins/funcspanRollupPlugin.mjs +18 -0
- package/dist/plugins/funcspanTscPlugin.cjs +1 -0
- package/dist/plugins/funcspanTscPlugin.mjs +39 -0
- package/dist/plugins/funcspanVitePlugin.cjs +1 -0
- package/dist/plugins/funcspanVitePlugin.mjs +17 -0
- package/dist/plugins/funcspanWebpackLoader.cjs +1 -0
- package/dist/plugins/funcspanWebpackLoader.mjs +15 -0
- package/dist/plugins/funcspanWebpackPlugin.cjs +1 -0
- package/dist/plugins/funcspanWebpackPlugin.mjs +28 -0
- package/dist/sf-veritas.cjs +38 -20
- package/dist/sf-veritas.mjs +850 -1239
- package/dist/source-map-Cr6YkjTd.js +631 -0
- package/dist/source-map-rHHEdpre.cjs +1 -0
- package/dist/types/baseTransmitter.d.ts +2 -1
- package/dist/types/contextManager.d.ts +23 -0
- package/dist/types/exceptionTransmitter.d.ts +1 -1
- package/dist/types/funcSpanCapture.d.ts +24 -0
- package/dist/types/funcSpanConfig.d.ts +83 -0
- package/dist/types/funcSpanConfigLoader.d.ts +70 -0
- package/dist/types/index.d.ts +4 -1
- package/dist/types/networkRequestTransmitter.d.ts +1 -0
- package/dist/types/plugins/funcSpanTransformer.d.ts +31 -0
- package/dist/types/plugins/funcspanEsbuildPlugin.d.ts +28 -0
- package/dist/types/plugins/funcspanRollupPlugin.d.ts +28 -0
- package/dist/types/plugins/funcspanTscPlugin.d.ts +35 -0
- package/dist/types/plugins/funcspanVitePlugin.d.ts +27 -0
- package/dist/types/plugins/funcspanWebpackLoader.d.ts +1 -0
- package/dist/types/plugins/funcspanWebpackPlugin.d.ts +32 -0
- package/package.json +49 -3
package/dist/sf-veritas.mjs
CHANGED
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { AsyncLocalStorage as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
var fe = Object.defineProperty;
|
|
2
|
+
var ye = (s, e, t) => e in s ? fe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var u = (s, e, t) => ye(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { AsyncLocalStorage as te } from "async_hooks";
|
|
5
|
+
import * as $ from "fs";
|
|
6
|
+
import { readFileSync as ue } from "fs";
|
|
7
|
+
import { s as Ce } from "./source-map-Cr6YkjTd.js";
|
|
8
|
+
import { Worker as Se } from "worker_threads";
|
|
9
|
+
import * as v from "path";
|
|
10
|
+
import { glob as Ze } from "glob";
|
|
11
|
+
const S = [];
|
|
12
|
+
for (let s = 0; s < 256; ++s) S.push((s + 256).toString(16).slice(1));
|
|
13
|
+
let k;
|
|
14
|
+
const Ge = new Uint8Array(16), oe = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
|
|
15
|
+
function H(s, e, t) {
|
|
16
|
+
if (oe.randomUUID && !s) return oe.randomUUID();
|
|
17
|
+
const i = (s = s || {}).random ?? s.rng?.() ?? (function() {
|
|
18
|
+
if (!k) {
|
|
15
19
|
if (typeof crypto > "u" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
16
|
-
|
|
20
|
+
k = crypto.getRandomValues.bind(crypto);
|
|
17
21
|
}
|
|
18
|
-
return
|
|
22
|
+
return k(Ge);
|
|
19
23
|
})();
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
22
|
-
return (
|
|
23
|
-
})(
|
|
24
|
+
if (i.length < 16) throw new Error("Random bytes length must be >= 16");
|
|
25
|
+
return i[6] = 15 & i[6] | 64, i[8] = 63 & i[8] | 128, (function(n, o = 0) {
|
|
26
|
+
return (S[n[o + 0]] + S[n[o + 1]] + S[n[o + 2]] + S[n[o + 3]] + "-" + S[n[o + 4]] + S[n[o + 5]] + "-" + S[n[o + 6]] + S[n[o + 7]] + "-" + S[n[o + 8]] + S[n[o + 9]] + "-" + S[n[o + 10]] + S[n[o + 11]] + S[n[o + 12]] + S[n[o + 13]] + S[n[o + 14]] + S[n[o + 15]]).toLowerCase();
|
|
27
|
+
})(i);
|
|
24
28
|
}
|
|
25
|
-
class
|
|
26
|
-
constructor(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.apiKey =
|
|
29
|
+
class ve {
|
|
30
|
+
constructor(e) {
|
|
31
|
+
u(this, "apiKey");
|
|
32
|
+
u(this, "apiGraphqlEndpoint");
|
|
33
|
+
u(this, "sfDebug");
|
|
34
|
+
u(this, "serviceIdentifier");
|
|
35
|
+
u(this, "serviceVersion");
|
|
36
|
+
u(this, "serviceUUID");
|
|
37
|
+
u(this, "serviceAdditionalMetadata");
|
|
38
|
+
u(this, "profilingModeEnabled");
|
|
39
|
+
u(this, "profilingMaxDepth");
|
|
40
|
+
u(this, "profilingMaxVariableSizeKb");
|
|
41
|
+
u(this, "domainsToNotPropagateHeadersTo");
|
|
42
|
+
u(this, "nodeModulesToCollectLocalVariablesOn");
|
|
43
|
+
u(this, "printConfigurationStatuses");
|
|
44
|
+
u(this, "logLevel");
|
|
45
|
+
u(this, "stackDepthLocals");
|
|
46
|
+
u(this, "stackDepthCodeTraceDepth");
|
|
47
|
+
u(this, "packageLibraryType");
|
|
48
|
+
u(this, "version");
|
|
49
|
+
u(this, "gitSha");
|
|
50
|
+
u(this, "_serviceIdentificationReceived", !1);
|
|
51
|
+
this.apiKey = e.apiKey, this.apiGraphqlEndpoint = e?.apiGraphqlEndpoint || process.env.SAILFISH_GRAPHQL_ENDPOINT || "https://api-service.sailfishqa.com/graphql/", this.sfDebug = e?.debug === !0 || process.env.SF_DEBUG === "true", this.serviceIdentifier = e?.serviceIdentifier || process.env.SERVICE_IDENTIFIER, this.serviceUUID = H(), this.serviceVersion = e?.serviceVersion || process.env.SERVICE_VERSION, this.gitSha = e?.gitSha || process.env.GIT_SHA || process.env.VERCEL_GIT_COMMIT_SHA, this.serviceAdditionalMetadata = e?.serviceAdditionalMetadata || {}, this.profilingModeEnabled = e?.profilingModeEnabled ?? !1, this.profilingMaxDepth = e?.profilingMaxDepth ?? 5, this.profilingMaxVariableSizeKb = e?.profilingMaxVariableSizeKb ?? 25, this.domainsToNotPropagateHeadersTo = e?.domainsToNotPropagateHeadersTo || [], this.nodeModulesToCollectLocalVariablesOn = e?.nodeModulesToCollectLocalVariablesOn || ["_all_"], this.printConfigurationStatuses = process.env.PRINT_CONFIGURATION_STATUSES || "true", this.logLevel = process.env.LOG_LEVEL || "INFO", this.stackDepthLocals = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS, 10) : 5, isNaN(this.stackDepthLocals) && (this.stackDepthLocals = -1), this.stackDepthCodeTraceDepth = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH, 10) : -1, isNaN(this.stackDepthCodeTraceDepth) && (this.stackDepthCodeTraceDepth = -1), this.packageLibraryType = "JS/TS BACKEND", this.version = this.getPackageVersion();
|
|
48
52
|
}
|
|
49
53
|
getPackageVersion() {
|
|
50
54
|
return "0.1.15";
|
|
@@ -52,71 +56,71 @@ class Pe {
|
|
|
52
56
|
get serviceIdentificationReceived() {
|
|
53
57
|
return this._serviceIdentificationReceived;
|
|
54
58
|
}
|
|
55
|
-
setServiceIdentificationReceived(
|
|
56
|
-
this._serviceIdentificationReceived =
|
|
59
|
+
setServiceIdentificationReceived(e) {
|
|
60
|
+
this._serviceIdentificationReceived = e;
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
|
-
const
|
|
60
|
-
function
|
|
61
|
-
return globalThis[
|
|
63
|
+
const pe = Symbol.for("sailfish.sf_config");
|
|
64
|
+
function he() {
|
|
65
|
+
return globalThis[pe];
|
|
62
66
|
}
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
67
|
-
return (function(
|
|
68
|
-
globalThis[
|
|
69
|
-
})(
|
|
67
|
+
function Be(s) {
|
|
68
|
+
const e = he();
|
|
69
|
+
if (e) return { config: e };
|
|
70
|
+
const t = new ve(s);
|
|
71
|
+
return (function(i) {
|
|
72
|
+
globalThis[pe] = i;
|
|
73
|
+
})(t), t.sfDebug && console.log("[[getOrCreateConfig]] Created global config:", t), { config: t };
|
|
70
74
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
74
|
-
return
|
|
75
|
+
function l() {
|
|
76
|
+
const s = he();
|
|
77
|
+
if (!s) throw new Error("Configuration has not been initialized. Call getOrCreateConfig(options) first.");
|
|
78
|
+
return s;
|
|
75
79
|
}
|
|
76
|
-
const
|
|
80
|
+
const se = Symbol.for("sf.ctx.storeAls"), W = globalThis, O = W[se] ?? (W[se] = new te()), Ae = ["identitytoolkit.googleapis.com", "t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com"], re = Symbol.for("sf.ctx.als"), U = W[re] ?? (W[re] = new te()), ae = Symbol.for("sf.ctx.sessionRegistry"), Y = W[ae] ?? (W[ae] = /* @__PURE__ */ new Map()), _ = { handledExceptions: /* @__PURE__ */ new Set(), reentrancyGuardLoggingActive: !1, reentrancyGuardLoggingPreActive: !1, reentrancyGuardPrintActive: !1, reentrancyGuardPrintPreActive: !1, reentrancyGuardExceptionActive: !1, reentrancyGuardExceptionPreActive: !1, excludedDomains: new Set(Ae), supportedDomains: /* @__PURE__ */ new Set() }, V = class V {
|
|
77
81
|
constructor() {
|
|
78
82
|
}
|
|
79
83
|
current() {
|
|
80
|
-
return
|
|
84
|
+
return O.getStore();
|
|
81
85
|
}
|
|
82
86
|
ensureStore() {
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
+
const e = this.current();
|
|
88
|
+
if (e) return e;
|
|
89
|
+
const t = /* @__PURE__ */ new Map();
|
|
90
|
+
return O.enterWith(t), t;
|
|
87
91
|
}
|
|
88
|
-
runWith(
|
|
89
|
-
const
|
|
90
|
-
for (const [
|
|
91
|
-
return
|
|
92
|
+
runWith(e, t) {
|
|
93
|
+
const i = this.current() ?? /* @__PURE__ */ new Map(), n = new Map(i);
|
|
94
|
+
for (const [o, a] of Object.entries(e)) n.set(o, a);
|
|
95
|
+
return O.run(n, t);
|
|
92
96
|
}
|
|
93
97
|
static getInstance() {
|
|
94
|
-
return
|
|
98
|
+
return W[V.GLOBAL_MANAGER_SYMBOL] || (W[V.GLOBAL_MANAGER_SYMBOL] = new V()), W[V.GLOBAL_MANAGER_SYMBOL];
|
|
95
99
|
}
|
|
96
100
|
getCurrentContext() {
|
|
97
|
-
return
|
|
101
|
+
return U.getStore() || _;
|
|
98
102
|
}
|
|
99
|
-
setCurrentContext(
|
|
100
|
-
const
|
|
101
|
-
|
|
103
|
+
setCurrentContext(e) {
|
|
104
|
+
const t = U.getStore() || _;
|
|
105
|
+
U.enterWith({ ...t, ...e });
|
|
102
106
|
}
|
|
103
|
-
ensureSession(
|
|
104
|
-
let
|
|
105
|
-
return
|
|
107
|
+
ensureSession(e) {
|
|
108
|
+
let t = Y.get(e);
|
|
109
|
+
return t || (t = { ..._ }, Y.set(e, t)), t;
|
|
106
110
|
}
|
|
107
|
-
getContextFor(
|
|
108
|
-
return
|
|
111
|
+
getContextFor(e) {
|
|
112
|
+
return Y.get(e) ?? _;
|
|
109
113
|
}
|
|
110
|
-
updateContextFor(
|
|
111
|
-
const
|
|
112
|
-
|
|
114
|
+
updateContextFor(e, t) {
|
|
115
|
+
const i = this.ensureSession(e);
|
|
116
|
+
Y.set(e, { ...i, ...t });
|
|
113
117
|
}
|
|
114
|
-
runWithSession(
|
|
115
|
-
const
|
|
116
|
-
return
|
|
118
|
+
runWithSession(e, t) {
|
|
119
|
+
const i = { ...this.ensureSession(e) };
|
|
120
|
+
return U.run(i, t);
|
|
117
121
|
}
|
|
118
|
-
deleteSession(
|
|
119
|
-
|
|
122
|
+
deleteSession(e) {
|
|
123
|
+
Y.delete(e);
|
|
120
124
|
}
|
|
121
125
|
getTraceId() {
|
|
122
126
|
return this.getCurrentContext().traceId;
|
|
@@ -124,29 +128,38 @@ const pe = Symbol.for("sf.ctx.storeAls"), _ = globalThis, ne = _[pe] ?? (_[pe] =
|
|
|
124
128
|
getPageVisitUUID() {
|
|
125
129
|
return this.getCurrentContext().pageVisitUUID;
|
|
126
130
|
}
|
|
127
|
-
setTraceId(
|
|
128
|
-
this.setCurrentContext({ traceId:
|
|
131
|
+
setTraceId(e) {
|
|
132
|
+
this.setCurrentContext({ traceId: e });
|
|
133
|
+
}
|
|
134
|
+
setPageVisitUUID(e) {
|
|
135
|
+
this.setCurrentContext({ pageVisitUUID: e });
|
|
136
|
+
}
|
|
137
|
+
getCurrentFunctionSpanId() {
|
|
138
|
+
return this.getCurrentContext().currentFunctionSpanId;
|
|
139
|
+
}
|
|
140
|
+
setCurrentFunctionSpanId(e) {
|
|
141
|
+
this.setCurrentContext({ currentFunctionSpanId: e });
|
|
129
142
|
}
|
|
130
|
-
|
|
131
|
-
this.setCurrentContext({
|
|
143
|
+
clearCurrentFunctionSpanId() {
|
|
144
|
+
this.setCurrentContext({ currentFunctionSpanId: void 0 });
|
|
132
145
|
}
|
|
133
|
-
getOrSetSfTraceId(
|
|
134
|
-
let
|
|
135
|
-
return
|
|
146
|
+
getOrSetSfTraceId(e, t = !1) {
|
|
147
|
+
let i = this.getTraceId();
|
|
148
|
+
return i || (i = e || (t ? H() : `nonsession-applogs-v3/${l().apiKey}/${H()}`), this.setTraceId(i), l().sfDebug && console.log(" Created new trace ID:", i), i);
|
|
136
149
|
}
|
|
137
150
|
getOrSetPageVisitUUID() {
|
|
138
|
-
let
|
|
139
|
-
return
|
|
151
|
+
let e = this.getPageVisitUUID();
|
|
152
|
+
return e || (e = H(), this.setPageVisitUUID(e), l().sfDebug && console.log(" Created new page visit UUID:", e), e);
|
|
140
153
|
}
|
|
141
154
|
getHandledExceptions() {
|
|
142
155
|
return this.getCurrentContext().handledExceptions;
|
|
143
156
|
}
|
|
144
|
-
markExceptionHandled(
|
|
145
|
-
const
|
|
146
|
-
|
|
157
|
+
markExceptionHandled(e) {
|
|
158
|
+
const t = this.getHandledExceptions();
|
|
159
|
+
t.add(e), this.setCurrentContext({ handledExceptions: t });
|
|
147
160
|
}
|
|
148
|
-
hasHandledException(
|
|
149
|
-
return this.getHandledExceptions().has(
|
|
161
|
+
hasHandledException(e) {
|
|
162
|
+
return this.getHandledExceptions().has(e);
|
|
150
163
|
}
|
|
151
164
|
resetHandledExceptions() {
|
|
152
165
|
this.setCurrentContext({ handledExceptions: /* @__PURE__ */ new Set() });
|
|
@@ -157,94 +170,97 @@ const pe = Symbol.for("sf.ctx.storeAls"), _ = globalThis, ne = _[pe] ?? (_[pe] =
|
|
|
157
170
|
getSupportedDomains() {
|
|
158
171
|
return this.getCurrentContext().supportedDomains;
|
|
159
172
|
}
|
|
160
|
-
addSupportedDomains(
|
|
161
|
-
this.getCurrentContext().supportedDomains.add(
|
|
173
|
+
addSupportedDomains(e) {
|
|
174
|
+
this.getCurrentContext().supportedDomains.add(e.toLowerCase().trim());
|
|
162
175
|
}
|
|
163
|
-
setTraceIdFor(
|
|
164
|
-
this.updateContextFor(
|
|
176
|
+
setTraceIdFor(e, t) {
|
|
177
|
+
this.updateContextFor(e, { traceId: t });
|
|
165
178
|
}
|
|
166
|
-
setPageVisitUUIDFor(
|
|
167
|
-
this.updateContextFor(
|
|
179
|
+
setPageVisitUUIDFor(e, t) {
|
|
180
|
+
this.updateContextFor(e, { pageVisitUUID: t });
|
|
168
181
|
}
|
|
169
182
|
};
|
|
170
|
-
|
|
171
|
-
let
|
|
172
|
-
function
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
183
|
+
u(V, "GLOBAL_MANAGER_SYMBOL", Symbol.for("sf.ctx.manager"));
|
|
184
|
+
let G = V;
|
|
185
|
+
function Ne(s) {
|
|
186
|
+
const e = { ...G.getInstance().getCurrentContext() };
|
|
187
|
+
U.run(e, () => {
|
|
188
|
+
s();
|
|
176
189
|
});
|
|
177
190
|
}
|
|
178
|
-
|
|
191
|
+
function P() {
|
|
192
|
+
return G.getInstance().getCurrentFunctionSpanId();
|
|
193
|
+
}
|
|
194
|
+
class R {
|
|
179
195
|
constructor() {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
this.apiKey =
|
|
196
|
+
u(this, "apiKey");
|
|
197
|
+
u(this, "endpoint");
|
|
198
|
+
u(this, "queryType", "mutation");
|
|
199
|
+
u(this, "operationName", "");
|
|
200
|
+
u(this, "serviceUUID", l().serviceUUID);
|
|
201
|
+
u(this, "contextManager");
|
|
202
|
+
this.apiKey = l().apiKey, this.endpoint = l().apiGraphqlEndpoint, this.contextManager = G.getInstance();
|
|
187
203
|
}
|
|
188
204
|
get queryName() {
|
|
189
205
|
return this.operationName ? this.operationName.charAt(0).toLowerCase() + this.operationName.slice(1) : "";
|
|
190
206
|
}
|
|
191
207
|
getDefaultVariables() {
|
|
192
|
-
const
|
|
193
|
-
return { apiKey: this.apiKey, serviceUuid: this.serviceUUID, sessionId:
|
|
208
|
+
const e = Date.now().toString(), t = this.contextManager.getOrSetSfTraceId(), i = this.contextManager.getCurrentFunctionSpanId();
|
|
209
|
+
return { apiKey: this.apiKey, serviceUuid: this.serviceUUID, sessionId: t, timestampMs: e, parentSpanId: i };
|
|
194
210
|
}
|
|
195
|
-
getVariables(
|
|
196
|
-
return { ...this.getDefaultVariables(), ...
|
|
211
|
+
getVariables(e = {}) {
|
|
212
|
+
return { ...this.getDefaultVariables(), ...e };
|
|
197
213
|
}
|
|
198
|
-
setOperationName(
|
|
199
|
-
this.operationName =
|
|
214
|
+
setOperationName(e) {
|
|
215
|
+
this.operationName = e;
|
|
200
216
|
}
|
|
201
|
-
setEndpoint(
|
|
202
|
-
this.endpoint =
|
|
217
|
+
setEndpoint(e) {
|
|
218
|
+
this.endpoint = e;
|
|
203
219
|
}
|
|
204
|
-
setServiceUUID(
|
|
205
|
-
this.serviceUUID =
|
|
220
|
+
setServiceUUID(e) {
|
|
221
|
+
this.serviceUUID = e;
|
|
206
222
|
}
|
|
207
223
|
}
|
|
208
|
-
const
|
|
209
|
-
async function
|
|
224
|
+
const We = fetch;
|
|
225
|
+
async function F(s, e, t, i) {
|
|
210
226
|
try {
|
|
211
|
-
const
|
|
212
|
-
let
|
|
227
|
+
const n = l();
|
|
228
|
+
let o;
|
|
213
229
|
try {
|
|
214
|
-
|
|
230
|
+
o = JSON.stringify({ query: t, variables: i, operationName: e });
|
|
215
231
|
} catch {
|
|
216
|
-
|
|
232
|
+
o = JSON.stringify({ query: t, operationName: e });
|
|
217
233
|
}
|
|
218
|
-
|
|
219
|
-
if (!
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
console.error(
|
|
224
|
-
})(
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
})(
|
|
228
|
-
}).catch((
|
|
229
|
-
|
|
234
|
+
We(s, { method: "POST", headers: { "Content-Type": "application/json" }, body: o }).then(async (a) => {
|
|
235
|
+
if (!a.ok) return void (n.sfDebug && console.error(`GraphQL request failed with status ${a.status} for ${e}`));
|
|
236
|
+
const r = await a.json();
|
|
237
|
+
r.errors?.length ? (function(g, c, I) {
|
|
238
|
+
const d = g && typeof g == "object" && !Array.isArray(g) ? Object.keys(g)[0] : void 0;
|
|
239
|
+
console.error(d === "identifyServiceDetails" ? `IdentifyServiceDetails NOT sent successfully for service: UUID=${I.serviceUUID}` : `GraphQL request failed with errors: ${JSON.stringify(c)} for operation key ${d}`);
|
|
240
|
+
})(r.data, r.errors, n) : n.sfDebug && (function(g, c, I) {
|
|
241
|
+
const d = g && typeof g == "object" && !Array.isArray(g) ? Object.keys(g)[0] : void 0, C = g[d] || !1;
|
|
242
|
+
d === "identifyServiceDetails" && (I.setServiceIdentificationReceived(C), l().sfDebug && console.log(`IdentifyServiceDetails sent successfully for service: UUID=${I.serviceUUID}; serviceIdentificationReceived=${d === "identifyServiceDetails" ? C : "N/A"}`));
|
|
243
|
+
})(r.data, 0, n);
|
|
244
|
+
}).catch((a) => {
|
|
245
|
+
n.sfDebug && console.error("Fetch error:", a);
|
|
230
246
|
});
|
|
231
|
-
} catch (
|
|
232
|
-
|
|
247
|
+
} catch (n) {
|
|
248
|
+
l().sfDebug && console.error("Error sending data to GraphQL server:", n);
|
|
233
249
|
}
|
|
234
250
|
}
|
|
235
|
-
class
|
|
251
|
+
class T extends R {
|
|
236
252
|
constructor() {
|
|
237
253
|
super(), this.setOperationName("IdentifyServiceDetails");
|
|
238
254
|
}
|
|
239
|
-
async doSend(
|
|
240
|
-
if (!
|
|
255
|
+
async doSend(e) {
|
|
256
|
+
if (!l().serviceIdentificationReceived) try {
|
|
241
257
|
this.send();
|
|
242
|
-
} catch (
|
|
243
|
-
|
|
258
|
+
} catch (t) {
|
|
259
|
+
l().sfDebug && console.error(" Error during service identification:", t);
|
|
244
260
|
}
|
|
245
261
|
}
|
|
246
262
|
async send() {
|
|
247
|
-
const
|
|
263
|
+
const e = `
|
|
248
264
|
${this.queryType} ${this.operationName}(
|
|
249
265
|
$apiKey: String!,
|
|
250
266
|
$timestampMs: String!,
|
|
@@ -268,42 +284,42 @@ class D extends E {
|
|
|
268
284
|
gitSha: $gitSha,
|
|
269
285
|
)
|
|
270
286
|
}
|
|
271
|
-
`,
|
|
272
|
-
|
|
287
|
+
`, t = this.getVariables({ serviceIdentifier: l().serviceIdentifier, serviceVersion: l().serviceVersion, library: l().packageLibraryType, version: l().version, serviceAdditionalMetadata: l().serviceAdditionalMetadata, gitSha: l().gitSha || "" });
|
|
288
|
+
F(this.endpoint, this.operationName, e, t);
|
|
273
289
|
}
|
|
274
290
|
}
|
|
275
|
-
function
|
|
291
|
+
function Fe(s) {
|
|
276
292
|
try {
|
|
277
|
-
return JSON.stringify(
|
|
293
|
+
return JSON.stringify(s), !0;
|
|
278
294
|
} catch {
|
|
279
295
|
return !1;
|
|
280
296
|
}
|
|
281
297
|
}
|
|
282
|
-
class
|
|
298
|
+
class Ve extends R {
|
|
283
299
|
constructor() {
|
|
284
300
|
super();
|
|
285
|
-
|
|
301
|
+
u(this, "serviceIdentifier", new T());
|
|
286
302
|
this.setOperationName("CollectMetadata");
|
|
287
303
|
}
|
|
288
304
|
async sendAppIdentifier() {
|
|
289
305
|
this.serviceIdentifier.doSend({});
|
|
290
306
|
}
|
|
291
|
-
async doSend(
|
|
292
|
-
this.sendAppIdentifier(), this.send(
|
|
293
|
-
}
|
|
294
|
-
async send(
|
|
295
|
-
if (!
|
|
296
|
-
let
|
|
297
|
-
if (!
|
|
298
|
-
const
|
|
299
|
-
const
|
|
300
|
-
if (
|
|
301
|
-
return { traitsJson: JSON.stringify(
|
|
302
|
-
})(
|
|
303
|
-
|
|
307
|
+
async doSend(t, i, n, o) {
|
|
308
|
+
this.sendAppIdentifier(), this.send(t, i, n, o);
|
|
309
|
+
}
|
|
310
|
+
async send(t, i, n, o) {
|
|
311
|
+
if (!i && !o) throw new Error('Must pass in either traits or traits_json to "add_or_update_traits"');
|
|
312
|
+
let a = [];
|
|
313
|
+
if (!o) {
|
|
314
|
+
const g = (function(c) {
|
|
315
|
+
const I = {}, d = [];
|
|
316
|
+
if (c) for (const [C, p] of Object.entries(c)) Fe(p) ? I[C] = p : d.push(C);
|
|
317
|
+
return { traitsJson: JSON.stringify(I), excludedFields: d };
|
|
318
|
+
})(i);
|
|
319
|
+
o = g.traitsJson, a = g.excludedFields;
|
|
304
320
|
}
|
|
305
|
-
const
|
|
306
|
-
|
|
321
|
+
const r = this.getVariables({ userId: t, traitsJson: o, excludedFields: a, override: n, library: l().packageLibraryType, version: l().version });
|
|
322
|
+
F(this.endpoint, this.operationName, this.getQuery(), r);
|
|
307
323
|
}
|
|
308
324
|
getQuery() {
|
|
309
325
|
return `
|
|
@@ -313,905 +329,293 @@ class et extends E {
|
|
|
313
329
|
`;
|
|
314
330
|
}
|
|
315
331
|
}
|
|
316
|
-
class
|
|
317
|
-
constructor(
|
|
318
|
-
|
|
319
|
-
this.apiKey =
|
|
332
|
+
class me {
|
|
333
|
+
constructor(e) {
|
|
334
|
+
u(this, "metadataTransmitter");
|
|
335
|
+
this.apiKey = e, this.metadataTransmitter = new Ve();
|
|
320
336
|
}
|
|
321
|
-
identify(
|
|
322
|
-
|
|
337
|
+
identify(e, t, i, n = !1) {
|
|
338
|
+
t || i ? this.addOrUpdateMetadata(e, t, i, n) : this.addOrUpdateMetadata(e, {}, void 0, n);
|
|
323
339
|
}
|
|
324
|
-
addOrUpdateMetadata(
|
|
325
|
-
if (!
|
|
326
|
-
|
|
340
|
+
addOrUpdateMetadata(e, t = {}, i, n = !1) {
|
|
341
|
+
if (!t && !i) throw new Error('Must pass in either traits or traitsJson to "addOrUpdateMetadata"');
|
|
342
|
+
l().sfDebug && console.log(" [[DEBUG - addOrUpdateMetadata]] Starting operation"), l().sfDebug && console.log(" addOrUpdateMetadata...SENDING DATA...", e, t, i), this.metadataTransmitter.doSend(e, t, n, i);
|
|
327
343
|
}
|
|
328
344
|
}
|
|
329
|
-
class
|
|
345
|
+
class ne extends R {
|
|
330
346
|
constructor() {
|
|
331
347
|
super();
|
|
332
|
-
|
|
348
|
+
u(this, "serviceIdentifier", new T());
|
|
333
349
|
}
|
|
334
350
|
async sendAppIdentifier() {
|
|
335
351
|
this.serviceIdentifier.doSend({});
|
|
336
352
|
}
|
|
337
|
-
async doSend(
|
|
338
|
-
this.sendAppIdentifier(), this.send(
|
|
353
|
+
async doSend(t) {
|
|
354
|
+
this.sendAppIdentifier(), this.send(t);
|
|
339
355
|
}
|
|
340
|
-
async send(
|
|
356
|
+
async send(t) {
|
|
341
357
|
try {
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
} catch (
|
|
345
|
-
|
|
358
|
+
const i = Array.isArray(t) ? t : [t, "default"], n = this.getVariables({ contents: i[0], level: i[1] });
|
|
359
|
+
F(this.endpoint, this.operationName, this.getQuery(), n);
|
|
360
|
+
} catch (i) {
|
|
361
|
+
l().sfDebug && console.error("🚨 Error in send():", i);
|
|
346
362
|
}
|
|
347
363
|
}
|
|
348
364
|
getQuery() {
|
|
349
365
|
return `
|
|
350
|
-
${this.queryType} ${this.operationName}(
|
|
351
|
-
|
|
366
|
+
${this.queryType} ${this.operationName}(
|
|
367
|
+
$apiKey: String!,
|
|
368
|
+
$serviceUuid: String!,
|
|
369
|
+
$sessionId: String!,
|
|
370
|
+
$timestampMs: String!,
|
|
371
|
+
$level: String!,
|
|
372
|
+
$contents: String!,
|
|
373
|
+
$parentSpanId: String
|
|
374
|
+
) {
|
|
375
|
+
${this.queryName}(
|
|
376
|
+
apiKey: $apiKey,
|
|
377
|
+
serviceUuid: $serviceUuid,
|
|
378
|
+
sessionId: $sessionId,
|
|
379
|
+
timestampMs: $timestampMs,
|
|
380
|
+
level: $level,
|
|
381
|
+
contents: $contents,
|
|
382
|
+
parentSpanId: $parentSpanId
|
|
383
|
+
)
|
|
352
384
|
}
|
|
353
385
|
`;
|
|
354
386
|
}
|
|
355
387
|
}
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
function
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}, P;
|
|
368
|
-
}
|
|
369
|
-
function Te() {
|
|
370
|
-
if (Ae) return $;
|
|
371
|
-
Ae = 1;
|
|
372
|
-
var i = tt();
|
|
373
|
-
return $.encode = function(n) {
|
|
374
|
-
var s, l = "", a = (function(t) {
|
|
375
|
-
return t < 0 ? 1 + (-t << 1) : 0 + (t << 1);
|
|
376
|
-
})(n);
|
|
377
|
-
do
|
|
378
|
-
s = 31 & a, (a >>>= 5) > 0 && (s |= 32), l += i.encode(s);
|
|
379
|
-
while (a > 0);
|
|
380
|
-
return l;
|
|
381
|
-
}, $.decode = function(n, s, l) {
|
|
382
|
-
var a, t, o, c, d = n.length, p = 0, C = 0;
|
|
383
|
-
do {
|
|
384
|
-
if (s >= d) throw new Error("Expected more digits in base 64 VLQ value.");
|
|
385
|
-
if ((t = i.decode(n.charCodeAt(s++))) === -1) throw new Error("Invalid base64 digit: " + n.charAt(s - 1));
|
|
386
|
-
a = !!(32 & t), p += (t &= 31) << C, C += 5;
|
|
387
|
-
} while (a);
|
|
388
|
-
l.value = (c = (o = p) >> 1, 1 & ~o ? c : -c), l.rest = s;
|
|
389
|
-
}, $;
|
|
390
|
-
}
|
|
391
|
-
var fe, be = {};
|
|
392
|
-
function M() {
|
|
393
|
-
return fe || (fe = 1, (function(i) {
|
|
394
|
-
i.getArg = function(e, r, h) {
|
|
395
|
-
if (r in e) return e[r];
|
|
396
|
-
if (arguments.length === 3) return h;
|
|
397
|
-
throw new Error('"' + r + '" is a required argument.');
|
|
398
|
-
};
|
|
399
|
-
var n = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/, s = /^data:.+\,.+$/;
|
|
400
|
-
function l(e) {
|
|
401
|
-
var r = e.match(n);
|
|
402
|
-
return r ? { scheme: r[1], auth: r[2], host: r[3], port: r[4], path: r[5] } : null;
|
|
403
|
-
}
|
|
404
|
-
function a(e) {
|
|
405
|
-
var r = "";
|
|
406
|
-
return e.scheme && (r += e.scheme + ":"), r += "//", e.auth && (r += e.auth + "@"), e.host && (r += e.host), e.port && (r += ":" + e.port), e.path && (r += e.path), r;
|
|
407
|
-
}
|
|
408
|
-
i.urlParse = l, i.urlGenerate = a;
|
|
409
|
-
var t, o, c = (t = function(e) {
|
|
410
|
-
var r = e, h = l(e);
|
|
411
|
-
if (h) {
|
|
412
|
-
if (!h.path) return e;
|
|
413
|
-
r = h.path;
|
|
414
|
-
}
|
|
415
|
-
for (var u = i.isAbsolute(r), m = [], f = 0, b = 0; ; ) {
|
|
416
|
-
if (f = b, (b = r.indexOf("/", f)) === -1) {
|
|
417
|
-
m.push(r.slice(f));
|
|
418
|
-
break;
|
|
419
|
-
}
|
|
420
|
-
for (m.push(r.slice(f, b)); b < r.length && r[b] === "/"; ) b++;
|
|
421
|
-
}
|
|
422
|
-
var v, S = 0;
|
|
423
|
-
for (b = m.length - 1; b >= 0; b--) (v = m[b]) === "." ? m.splice(b, 1) : v === ".." ? S++ : S > 0 && (v === "" ? (m.splice(b + 1, S), S = 0) : (m.splice(b, 2), S--));
|
|
424
|
-
return (r = m.join("/")) === "" && (r = u ? "/" : "."), h ? (h.path = r, a(h)) : r;
|
|
425
|
-
}, o = [], function(e) {
|
|
426
|
-
for (var r = 0; r < o.length; r++) if (o[r].input === e) {
|
|
427
|
-
var h = o[0];
|
|
428
|
-
return o[0] = o[r], o[r] = h, o[0].result;
|
|
429
|
-
}
|
|
430
|
-
var u = t(e);
|
|
431
|
-
return o.unshift({ input: e, result: u }), o.length > 32 && o.pop(), u;
|
|
432
|
-
});
|
|
433
|
-
function d(e, r) {
|
|
434
|
-
e === "" && (e = "."), r === "" && (r = ".");
|
|
435
|
-
var h = l(r), u = l(e);
|
|
436
|
-
if (u && (e = u.path || "/"), h && !h.scheme) return u && (h.scheme = u.scheme), a(h);
|
|
437
|
-
if (h || r.match(s)) return r;
|
|
438
|
-
if (u && !u.host && !u.path) return u.host = r, a(u);
|
|
439
|
-
var m = r.charAt(0) === "/" ? r : c(e.replace(/\/+$/, "") + "/" + r);
|
|
440
|
-
return u ? (u.path = m, a(u)) : m;
|
|
441
|
-
}
|
|
442
|
-
i.normalize = c, i.join = d, i.isAbsolute = function(e) {
|
|
443
|
-
return e.charAt(0) === "/" || n.test(e);
|
|
444
|
-
}, i.relative = function(e, r) {
|
|
445
|
-
e === "" && (e = "."), e = e.replace(/\/$/, "");
|
|
446
|
-
for (var h = 0; r.indexOf(e + "/") !== 0; ) {
|
|
447
|
-
var u = e.lastIndexOf("/");
|
|
448
|
-
if (u < 0 || (e = e.slice(0, u)).match(/^([^\/]+:\/)?\/*$/)) return r;
|
|
449
|
-
++h;
|
|
450
|
-
}
|
|
451
|
-
return Array(h + 1).join("../") + r.substr(e.length + 1);
|
|
452
|
-
};
|
|
453
|
-
var p = !("__proto__" in /* @__PURE__ */ Object.create(null));
|
|
454
|
-
function C(e) {
|
|
455
|
-
return e;
|
|
456
|
-
}
|
|
457
|
-
function g(e) {
|
|
458
|
-
if (!e) return !1;
|
|
459
|
-
var r = e.length;
|
|
460
|
-
if (r < 9 || e.charCodeAt(r - 1) !== 95 || e.charCodeAt(r - 2) !== 95 || e.charCodeAt(r - 3) !== 111 || e.charCodeAt(r - 4) !== 116 || e.charCodeAt(r - 5) !== 111 || e.charCodeAt(r - 6) !== 114 || e.charCodeAt(r - 7) !== 112 || e.charCodeAt(r - 8) !== 95 || e.charCodeAt(r - 9) !== 95) return !1;
|
|
461
|
-
for (var h = r - 10; h >= 0; h--) if (e.charCodeAt(h) !== 36) return !1;
|
|
462
|
-
return !0;
|
|
463
|
-
}
|
|
464
|
-
function I(e, r) {
|
|
465
|
-
return e === r ? 0 : e === null ? 1 : r === null ? -1 : e > r ? 1 : -1;
|
|
466
|
-
}
|
|
467
|
-
i.toSetString = p ? C : function(e) {
|
|
468
|
-
return g(e) ? "$" + e : e;
|
|
469
|
-
}, i.fromSetString = p ? C : function(e) {
|
|
470
|
-
return g(e) ? e.slice(1) : e;
|
|
471
|
-
}, i.compareByOriginalPositions = function(e, r, h) {
|
|
472
|
-
var u = I(e.source, r.source);
|
|
473
|
-
return u !== 0 || (u = e.originalLine - r.originalLine) !== 0 || (u = e.originalColumn - r.originalColumn) !== 0 || h || (u = e.generatedColumn - r.generatedColumn) !== 0 || (u = e.generatedLine - r.generatedLine) !== 0 ? u : I(e.name, r.name);
|
|
474
|
-
}, i.compareByOriginalPositionsNoSource = function(e, r, h) {
|
|
475
|
-
var u;
|
|
476
|
-
return (u = e.originalLine - r.originalLine) !== 0 || (u = e.originalColumn - r.originalColumn) !== 0 || h || (u = e.generatedColumn - r.generatedColumn) !== 0 || (u = e.generatedLine - r.generatedLine) !== 0 ? u : I(e.name, r.name);
|
|
477
|
-
}, i.compareByGeneratedPositionsDeflated = function(e, r, h) {
|
|
478
|
-
var u = e.generatedLine - r.generatedLine;
|
|
479
|
-
return u !== 0 || (u = e.generatedColumn - r.generatedColumn) !== 0 || h || (u = I(e.source, r.source)) !== 0 || (u = e.originalLine - r.originalLine) !== 0 || (u = e.originalColumn - r.originalColumn) !== 0 ? u : I(e.name, r.name);
|
|
480
|
-
}, i.compareByGeneratedPositionsDeflatedNoLine = function(e, r, h) {
|
|
481
|
-
var u = e.generatedColumn - r.generatedColumn;
|
|
482
|
-
return u !== 0 || h || (u = I(e.source, r.source)) !== 0 || (u = e.originalLine - r.originalLine) !== 0 || (u = e.originalColumn - r.originalColumn) !== 0 ? u : I(e.name, r.name);
|
|
483
|
-
}, i.compareByGeneratedPositionsInflated = function(e, r) {
|
|
484
|
-
var h = e.generatedLine - r.generatedLine;
|
|
485
|
-
return h !== 0 || (h = e.generatedColumn - r.generatedColumn) !== 0 || (h = I(e.source, r.source)) !== 0 || (h = e.originalLine - r.originalLine) !== 0 || (h = e.originalColumn - r.originalColumn) !== 0 ? h : I(e.name, r.name);
|
|
486
|
-
}, i.parseSourceMapInput = function(e) {
|
|
487
|
-
return JSON.parse(e.replace(/^\)]}'[^\n]*\n/, ""));
|
|
488
|
-
}, i.computeSourceURL = function(e, r, h) {
|
|
489
|
-
if (r = r || "", e && (e[e.length - 1] !== "/" && r[0] !== "/" && (e += "/"), r = e + r), h) {
|
|
490
|
-
var u = l(h);
|
|
491
|
-
if (!u) throw new Error("sourceMapURL could not be parsed");
|
|
492
|
-
if (u.path) {
|
|
493
|
-
var m = u.path.lastIndexOf("/");
|
|
494
|
-
m >= 0 && (u.path = u.path.substring(0, m + 1));
|
|
495
|
-
}
|
|
496
|
-
r = d(a(u), r);
|
|
497
|
-
}
|
|
498
|
-
return c(r);
|
|
499
|
-
};
|
|
500
|
-
})(be)), be;
|
|
501
|
-
}
|
|
502
|
-
var ye, oe = {};
|
|
503
|
-
function Me() {
|
|
504
|
-
if (ye) return oe;
|
|
505
|
-
ye = 1;
|
|
506
|
-
var i = M(), n = Object.prototype.hasOwnProperty, s = typeof Map < "u";
|
|
507
|
-
function l() {
|
|
508
|
-
this._array = [], this._set = s ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
|
|
509
|
-
}
|
|
510
|
-
return l.fromArray = function(a, t) {
|
|
511
|
-
for (var o = new l(), c = 0, d = a.length; c < d; c++) o.add(a[c], t);
|
|
512
|
-
return o;
|
|
513
|
-
}, l.prototype.size = function() {
|
|
514
|
-
return s ? this._set.size : Object.getOwnPropertyNames(this._set).length;
|
|
515
|
-
}, l.prototype.add = function(a, t) {
|
|
516
|
-
var o = s ? a : i.toSetString(a), c = s ? this.has(a) : n.call(this._set, o), d = this._array.length;
|
|
517
|
-
c && !t || this._array.push(a), c || (s ? this._set.set(a, d) : this._set[o] = d);
|
|
518
|
-
}, l.prototype.has = function(a) {
|
|
519
|
-
if (s) return this._set.has(a);
|
|
520
|
-
var t = i.toSetString(a);
|
|
521
|
-
return n.call(this._set, t);
|
|
522
|
-
}, l.prototype.indexOf = function(a) {
|
|
523
|
-
if (s) {
|
|
524
|
-
var t = this._set.get(a);
|
|
525
|
-
if (t >= 0) return t;
|
|
526
|
-
} else {
|
|
527
|
-
var o = i.toSetString(a);
|
|
528
|
-
if (n.call(this._set, o)) return this._set[o];
|
|
529
|
-
}
|
|
530
|
-
throw new Error('"' + a + '" is not in the set.');
|
|
531
|
-
}, l.prototype.at = function(a) {
|
|
532
|
-
if (a >= 0 && a < this._array.length) return this._array[a];
|
|
533
|
-
throw new Error("No element indexed by " + a);
|
|
534
|
-
}, l.prototype.toArray = function() {
|
|
535
|
-
return this._array.slice();
|
|
536
|
-
}, oe.ArraySet = l, oe;
|
|
537
|
-
}
|
|
538
|
-
var ve, Se, ie = {};
|
|
539
|
-
function nt() {
|
|
540
|
-
if (ve) return ie;
|
|
541
|
-
ve = 1;
|
|
542
|
-
var i = M();
|
|
543
|
-
function n() {
|
|
544
|
-
this._array = [], this._sorted = !0, this._last = { generatedLine: -1, generatedColumn: 0 };
|
|
545
|
-
}
|
|
546
|
-
return n.prototype.unsortedForEach = function(s, l) {
|
|
547
|
-
this._array.forEach(s, l);
|
|
548
|
-
}, n.prototype.add = function(s) {
|
|
549
|
-
var l, a, t, o, c, d;
|
|
550
|
-
l = this._last, a = s, t = l.generatedLine, o = a.generatedLine, c = l.generatedColumn, d = a.generatedColumn, o > t || o == t && d >= c || i.compareByGeneratedPositionsInflated(l, a) <= 0 ? (this._last = s, this._array.push(s)) : (this._sorted = !1, this._array.push(s));
|
|
551
|
-
}, n.prototype.toArray = function() {
|
|
552
|
-
return this._sorted || (this._array.sort(i.compareByGeneratedPositionsInflated), this._sorted = !0), this._array;
|
|
553
|
-
}, ie.MappingList = n, ie;
|
|
554
|
-
}
|
|
555
|
-
function Ge() {
|
|
556
|
-
if (Se) return re;
|
|
557
|
-
Se = 1;
|
|
558
|
-
var i = Te(), n = M(), s = Me().ArraySet, l = nt().MappingList;
|
|
559
|
-
function a(t) {
|
|
560
|
-
t || (t = {}), this._file = n.getArg(t, "file", null), this._sourceRoot = n.getArg(t, "sourceRoot", null), this._skipValidation = n.getArg(t, "skipValidation", !1), this._ignoreInvalidMapping = n.getArg(t, "ignoreInvalidMapping", !1), this._sources = new s(), this._names = new s(), this._mappings = new l(), this._sourcesContents = null;
|
|
561
|
-
}
|
|
562
|
-
return a.prototype._version = 3, a.fromSourceMap = function(t, o) {
|
|
563
|
-
var c = t.sourceRoot, d = new a(Object.assign(o || {}, { file: t.file, sourceRoot: c }));
|
|
564
|
-
return t.eachMapping(function(p) {
|
|
565
|
-
var C = { generated: { line: p.generatedLine, column: p.generatedColumn } };
|
|
566
|
-
p.source != null && (C.source = p.source, c != null && (C.source = n.relative(c, C.source)), C.original = { line: p.originalLine, column: p.originalColumn }, p.name != null && (C.name = p.name)), d.addMapping(C);
|
|
567
|
-
}), t.sources.forEach(function(p) {
|
|
568
|
-
var C = p;
|
|
569
|
-
c !== null && (C = n.relative(c, p)), d._sources.has(C) || d._sources.add(C);
|
|
570
|
-
var g = t.sourceContentFor(p);
|
|
571
|
-
g != null && d.setSourceContent(p, g);
|
|
572
|
-
}), d;
|
|
573
|
-
}, a.prototype.addMapping = function(t) {
|
|
574
|
-
var o = n.getArg(t, "generated"), c = n.getArg(t, "original", null), d = n.getArg(t, "source", null), p = n.getArg(t, "name", null);
|
|
575
|
-
(this._skipValidation || this._validateMapping(o, c, d, p) !== !1) && (d != null && (d = String(d), this._sources.has(d) || this._sources.add(d)), p != null && (p = String(p), this._names.has(p) || this._names.add(p)), this._mappings.add({ generatedLine: o.line, generatedColumn: o.column, originalLine: c != null && c.line, originalColumn: c != null && c.column, source: d, name: p }));
|
|
576
|
-
}, a.prototype.setSourceContent = function(t, o) {
|
|
577
|
-
var c = t;
|
|
578
|
-
this._sourceRoot != null && (c = n.relative(this._sourceRoot, c)), o != null ? (this._sourcesContents || (this._sourcesContents = /* @__PURE__ */ Object.create(null)), this._sourcesContents[n.toSetString(c)] = o) : this._sourcesContents && (delete this._sourcesContents[n.toSetString(c)], Object.keys(this._sourcesContents).length === 0 && (this._sourcesContents = null));
|
|
579
|
-
}, a.prototype.applySourceMap = function(t, o, c) {
|
|
580
|
-
var d = o;
|
|
581
|
-
if (o == null) {
|
|
582
|
-
if (t.file == null) throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);
|
|
583
|
-
d = t.file;
|
|
584
|
-
}
|
|
585
|
-
var p = this._sourceRoot;
|
|
586
|
-
p != null && (d = n.relative(p, d));
|
|
587
|
-
var C = new s(), g = new s();
|
|
588
|
-
this._mappings.unsortedForEach(function(I) {
|
|
589
|
-
if (I.source === d && I.originalLine != null) {
|
|
590
|
-
var e = t.originalPositionFor({ line: I.originalLine, column: I.originalColumn });
|
|
591
|
-
e.source != null && (I.source = e.source, c != null && (I.source = n.join(c, I.source)), p != null && (I.source = n.relative(p, I.source)), I.originalLine = e.line, I.originalColumn = e.column, e.name != null && (I.name = e.name));
|
|
592
|
-
}
|
|
593
|
-
var r = I.source;
|
|
594
|
-
r == null || C.has(r) || C.add(r);
|
|
595
|
-
var h = I.name;
|
|
596
|
-
h == null || g.has(h) || g.add(h);
|
|
597
|
-
}, this), this._sources = C, this._names = g, t.sources.forEach(function(I) {
|
|
598
|
-
var e = t.sourceContentFor(I);
|
|
599
|
-
e != null && (c != null && (I = n.join(c, I)), p != null && (I = n.relative(p, I)), this.setSourceContent(I, e));
|
|
600
|
-
}, this);
|
|
601
|
-
}, a.prototype._validateMapping = function(t, o, c, d) {
|
|
602
|
-
if (o && typeof o.line != "number" && typeof o.column != "number") {
|
|
603
|
-
var p = "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";
|
|
604
|
-
if (this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(p), !1;
|
|
605
|
-
throw new Error(p);
|
|
606
|
-
}
|
|
607
|
-
if ((!(t && "line" in t && "column" in t && t.line > 0 && t.column >= 0) || o || c || d) && !(t && "line" in t && "column" in t && o && "line" in o && "column" in o && t.line > 0 && t.column >= 0 && o.line > 0 && o.column >= 0 && c)) {
|
|
608
|
-
if (p = "Invalid mapping: " + JSON.stringify({ generated: t, source: c, original: o, name: d }), this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(p), !1;
|
|
609
|
-
throw new Error(p);
|
|
610
|
-
}
|
|
611
|
-
}, a.prototype._serializeMappings = function() {
|
|
612
|
-
for (var t, o, c, d, p = 0, C = 1, g = 0, I = 0, e = 0, r = 0, h = "", u = this._mappings.toArray(), m = 0, f = u.length; m < f; m++) {
|
|
613
|
-
if (t = "", (o = u[m]).generatedLine !== C) for (p = 0; o.generatedLine !== C; ) t += ";", C++;
|
|
614
|
-
else if (m > 0) {
|
|
615
|
-
if (!n.compareByGeneratedPositionsInflated(o, u[m - 1])) continue;
|
|
616
|
-
t += ",";
|
|
617
|
-
}
|
|
618
|
-
t += i.encode(o.generatedColumn - p), p = o.generatedColumn, o.source != null && (d = this._sources.indexOf(o.source), t += i.encode(d - r), r = d, t += i.encode(o.originalLine - 1 - I), I = o.originalLine - 1, t += i.encode(o.originalColumn - g), g = o.originalColumn, o.name != null && (c = this._names.indexOf(o.name), t += i.encode(c - e), e = c)), h += t;
|
|
619
|
-
}
|
|
620
|
-
return h;
|
|
621
|
-
}, a.prototype._generateSourcesContent = function(t, o) {
|
|
622
|
-
return t.map(function(c) {
|
|
623
|
-
if (!this._sourcesContents) return null;
|
|
624
|
-
o != null && (c = n.relative(o, c));
|
|
625
|
-
var d = n.toSetString(c);
|
|
626
|
-
return Object.prototype.hasOwnProperty.call(this._sourcesContents, d) ? this._sourcesContents[d] : null;
|
|
627
|
-
}, this);
|
|
628
|
-
}, a.prototype.toJSON = function() {
|
|
629
|
-
var t = { version: this._version, sources: this._sources.toArray(), names: this._names.toArray(), mappings: this._serializeMappings() };
|
|
630
|
-
return this._file != null && (t.file = this._file), this._sourceRoot != null && (t.sourceRoot = this._sourceRoot), this._sourcesContents && (t.sourcesContent = this._generateSourcesContent(t.sources, t.sourceRoot)), t;
|
|
631
|
-
}, a.prototype.toString = function() {
|
|
632
|
-
return JSON.stringify(this.toJSON());
|
|
633
|
-
}, re.SourceMapGenerator = a, re;
|
|
634
|
-
}
|
|
635
|
-
var Ze, F = {}, Be = {};
|
|
636
|
-
function rt() {
|
|
637
|
-
return Ze || (Ze = 1, (function(i) {
|
|
638
|
-
function n(s, l, a, t, o, c) {
|
|
639
|
-
var d = Math.floor((l - s) / 2) + s, p = o(a, t[d], !0);
|
|
640
|
-
return p === 0 ? d : p > 0 ? l - d > 1 ? n(d, l, a, t, o, c) : c == i.LEAST_UPPER_BOUND ? l < t.length ? l : -1 : d : d - s > 1 ? n(s, d, a, t, o, c) : c == i.LEAST_UPPER_BOUND ? d : s < 0 ? -1 : s;
|
|
641
|
-
}
|
|
642
|
-
i.GREATEST_LOWER_BOUND = 1, i.LEAST_UPPER_BOUND = 2, i.search = function(s, l, a, t) {
|
|
643
|
-
if (l.length === 0) return -1;
|
|
644
|
-
var o = n(-1, l.length, s, l, a, t || i.GREATEST_LOWER_BOUND);
|
|
645
|
-
if (o < 0) return -1;
|
|
646
|
-
for (; o - 1 >= 0 && a(l[o], l[o - 1], !0) === 0; ) --o;
|
|
647
|
-
return o;
|
|
648
|
-
};
|
|
649
|
-
})(Be)), Be;
|
|
650
|
-
}
|
|
651
|
-
var We, we, se = {};
|
|
652
|
-
function ot() {
|
|
653
|
-
if (We) return se;
|
|
654
|
-
function i(s) {
|
|
655
|
-
function l(a, t, o) {
|
|
656
|
-
var c = a[t];
|
|
657
|
-
a[t] = a[o], a[o] = c;
|
|
658
|
-
}
|
|
659
|
-
return function a(t, o, c, d) {
|
|
660
|
-
if (c < d) {
|
|
661
|
-
var p = c - 1;
|
|
662
|
-
l(t, (e = c, r = d, Math.round(e + Math.random() * (r - e))), d);
|
|
663
|
-
for (var C = t[d], g = c; g < d; g++) o(t[g], C, !1) <= 0 && l(t, p += 1, g);
|
|
664
|
-
l(t, p + 1, g);
|
|
665
|
-
var I = p + 1;
|
|
666
|
-
a(t, o, c, I - 1), a(t, o, I + 1, d);
|
|
667
|
-
}
|
|
668
|
-
var e, r;
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
We = 1;
|
|
672
|
-
let n = /* @__PURE__ */ new WeakMap();
|
|
673
|
-
return se.quickSort = function(s, l, a = 0) {
|
|
674
|
-
let t = n.get(l);
|
|
675
|
-
t === void 0 && (t = (function(o) {
|
|
676
|
-
let c = i.toString();
|
|
677
|
-
return new Function(`return ${c}`)()(o);
|
|
678
|
-
})(l), n.set(l, t)), t(s, l, a, s.length - 1);
|
|
679
|
-
}, se;
|
|
680
|
-
}
|
|
681
|
-
var Ne, Re, ae = {}, De = (Re || (Re = 1, k.SourceMapGenerator = Ge().SourceMapGenerator, k.SourceMapConsumer = (function() {
|
|
682
|
-
if (we) return F;
|
|
683
|
-
we = 1;
|
|
684
|
-
var i = M(), n = rt(), s = Me().ArraySet, l = Te(), a = ot().quickSort;
|
|
685
|
-
function t(g, I) {
|
|
686
|
-
var e = g;
|
|
687
|
-
return typeof g == "string" && (e = i.parseSourceMapInput(g)), e.sections != null ? new C(e, I) : new o(e, I);
|
|
688
|
-
}
|
|
689
|
-
function o(g, I) {
|
|
690
|
-
var e = g;
|
|
691
|
-
typeof g == "string" && (e = i.parseSourceMapInput(g));
|
|
692
|
-
var r = i.getArg(e, "version"), h = i.getArg(e, "sources"), u = i.getArg(e, "names", []), m = i.getArg(e, "sourceRoot", null), f = i.getArg(e, "sourcesContent", null), b = i.getArg(e, "mappings"), v = i.getArg(e, "file", null);
|
|
693
|
-
if (r != this._version) throw new Error("Unsupported version: " + r);
|
|
694
|
-
m && (m = i.normalize(m)), h = h.map(String).map(i.normalize).map(function(S) {
|
|
695
|
-
return m && i.isAbsolute(m) && i.isAbsolute(S) ? i.relative(m, S) : S;
|
|
696
|
-
}), this._names = s.fromArray(u.map(String), !0), this._sources = s.fromArray(h, !0), this._absoluteSources = this._sources.toArray().map(function(S) {
|
|
697
|
-
return i.computeSourceURL(m, S, I);
|
|
698
|
-
}), this.sourceRoot = m, this.sourcesContent = f, this._mappings = b, this._sourceMapURL = I, this.file = v;
|
|
699
|
-
}
|
|
700
|
-
function c() {
|
|
701
|
-
this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null;
|
|
702
|
-
}
|
|
703
|
-
t.fromSourceMap = function(g, I) {
|
|
704
|
-
return o.fromSourceMap(g, I);
|
|
705
|
-
}, t.prototype._version = 3, t.prototype.__generatedMappings = null, Object.defineProperty(t.prototype, "_generatedMappings", { configurable: !0, enumerable: !0, get: function() {
|
|
706
|
-
return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings;
|
|
707
|
-
} }), t.prototype.__originalMappings = null, Object.defineProperty(t.prototype, "_originalMappings", { configurable: !0, enumerable: !0, get: function() {
|
|
708
|
-
return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings;
|
|
709
|
-
} }), t.prototype._charIsMappingSeparator = function(g, I) {
|
|
710
|
-
var e = g.charAt(I);
|
|
711
|
-
return e === ";" || e === ",";
|
|
712
|
-
}, t.prototype._parseMappings = function(g, I) {
|
|
713
|
-
throw new Error("Subclasses must implement _parseMappings");
|
|
714
|
-
}, t.GENERATED_ORDER = 1, t.ORIGINAL_ORDER = 2, t.GREATEST_LOWER_BOUND = 1, t.LEAST_UPPER_BOUND = 2, t.prototype.eachMapping = function(g, I, e) {
|
|
715
|
-
var r, h = I || null;
|
|
716
|
-
switch (e || t.GENERATED_ORDER) {
|
|
717
|
-
case t.GENERATED_ORDER:
|
|
718
|
-
r = this._generatedMappings;
|
|
719
|
-
break;
|
|
720
|
-
case t.ORIGINAL_ORDER:
|
|
721
|
-
r = this._originalMappings;
|
|
722
|
-
break;
|
|
723
|
-
default:
|
|
724
|
-
throw new Error("Unknown order of iteration.");
|
|
725
|
-
}
|
|
726
|
-
for (var u = this.sourceRoot, m = g.bind(h), f = this._names, b = this._sources, v = this._sourceMapURL, S = 0, B = r.length; S < B; S++) {
|
|
727
|
-
var W = r[S], Z = W.source === null ? null : b.at(W.source);
|
|
728
|
-
Z !== null && (Z = i.computeSourceURL(u, Z, v)), m({ source: Z, generatedLine: W.generatedLine, generatedColumn: W.generatedColumn, originalLine: W.originalLine, originalColumn: W.originalColumn, name: W.name === null ? null : f.at(W.name) });
|
|
729
|
-
}
|
|
730
|
-
}, t.prototype.allGeneratedPositionsFor = function(g) {
|
|
731
|
-
var I = i.getArg(g, "line"), e = { source: i.getArg(g, "source"), originalLine: I, originalColumn: i.getArg(g, "column", 0) };
|
|
732
|
-
if (e.source = this._findSourceIndex(e.source), e.source < 0) return [];
|
|
733
|
-
var r = [], h = this._findMapping(e, this._originalMappings, "originalLine", "originalColumn", i.compareByOriginalPositions, n.LEAST_UPPER_BOUND);
|
|
734
|
-
if (h >= 0) {
|
|
735
|
-
var u = this._originalMappings[h];
|
|
736
|
-
if (g.column === void 0) for (var m = u.originalLine; u && u.originalLine === m; ) r.push({ line: i.getArg(u, "generatedLine", null), column: i.getArg(u, "generatedColumn", null), lastColumn: i.getArg(u, "lastGeneratedColumn", null) }), u = this._originalMappings[++h];
|
|
737
|
-
else for (var f = u.originalColumn; u && u.originalLine === I && u.originalColumn == f; ) r.push({ line: i.getArg(u, "generatedLine", null), column: i.getArg(u, "generatedColumn", null), lastColumn: i.getArg(u, "lastGeneratedColumn", null) }), u = this._originalMappings[++h];
|
|
738
|
-
}
|
|
739
|
-
return r;
|
|
740
|
-
}, F.SourceMapConsumer = t, o.prototype = Object.create(t.prototype), o.prototype.consumer = t, o.prototype._findSourceIndex = function(g) {
|
|
741
|
-
var I, e = g;
|
|
742
|
-
if (this.sourceRoot != null && (e = i.relative(this.sourceRoot, e)), this._sources.has(e)) return this._sources.indexOf(e);
|
|
743
|
-
for (I = 0; I < this._absoluteSources.length; ++I) if (this._absoluteSources[I] == g) return I;
|
|
744
|
-
return -1;
|
|
745
|
-
}, o.fromSourceMap = function(g, I) {
|
|
746
|
-
var e = Object.create(o.prototype), r = e._names = s.fromArray(g._names.toArray(), !0), h = e._sources = s.fromArray(g._sources.toArray(), !0);
|
|
747
|
-
e.sourceRoot = g._sourceRoot, e.sourcesContent = g._generateSourcesContent(e._sources.toArray(), e.sourceRoot), e.file = g._file, e._sourceMapURL = I, e._absoluteSources = e._sources.toArray().map(function(W) {
|
|
748
|
-
return i.computeSourceURL(e.sourceRoot, W, I);
|
|
749
|
-
});
|
|
750
|
-
for (var u = g._mappings.toArray().slice(), m = e.__generatedMappings = [], f = e.__originalMappings = [], b = 0, v = u.length; b < v; b++) {
|
|
751
|
-
var S = u[b], B = new c();
|
|
752
|
-
B.generatedLine = S.generatedLine, B.generatedColumn = S.generatedColumn, S.source && (B.source = h.indexOf(S.source), B.originalLine = S.originalLine, B.originalColumn = S.originalColumn, S.name && (B.name = r.indexOf(S.name)), f.push(B)), m.push(B);
|
|
753
|
-
}
|
|
754
|
-
return a(e.__originalMappings, i.compareByOriginalPositions), e;
|
|
755
|
-
}, o.prototype._version = 3, Object.defineProperty(o.prototype, "sources", { get: function() {
|
|
756
|
-
return this._absoluteSources.slice();
|
|
757
|
-
} });
|
|
758
|
-
const d = i.compareByGeneratedPositionsDeflatedNoLine;
|
|
759
|
-
function p(g, I) {
|
|
760
|
-
let e = g.length, r = g.length - I;
|
|
761
|
-
if (!(r <= 1)) if (r == 2) {
|
|
762
|
-
let h = g[I], u = g[I + 1];
|
|
763
|
-
d(h, u) > 0 && (g[I] = u, g[I + 1] = h);
|
|
764
|
-
} else if (r < 20) for (let h = I; h < e; h++) for (let u = h; u > I; u--) {
|
|
765
|
-
let m = g[u - 1], f = g[u];
|
|
766
|
-
if (d(m, f) <= 0) break;
|
|
767
|
-
g[u - 1] = f, g[u] = m;
|
|
768
|
-
}
|
|
769
|
-
else a(g, d, I);
|
|
770
|
-
}
|
|
771
|
-
function C(g, I) {
|
|
772
|
-
var e = g;
|
|
773
|
-
typeof g == "string" && (e = i.parseSourceMapInput(g));
|
|
774
|
-
var r = i.getArg(e, "version"), h = i.getArg(e, "sections");
|
|
775
|
-
if (r != this._version) throw new Error("Unsupported version: " + r);
|
|
776
|
-
this._sources = new s(), this._names = new s();
|
|
777
|
-
var u = { line: -1, column: 0 };
|
|
778
|
-
this._sections = h.map(function(m) {
|
|
779
|
-
if (m.url) throw new Error("Support for url field in sections not implemented.");
|
|
780
|
-
var f = i.getArg(m, "offset"), b = i.getArg(f, "line"), v = i.getArg(f, "column");
|
|
781
|
-
if (b < u.line || b === u.line && v < u.column) throw new Error("Section offsets must be ordered and non-overlapping.");
|
|
782
|
-
return u = f, { generatedOffset: { generatedLine: b + 1, generatedColumn: v + 1 }, consumer: new t(i.getArg(m, "map"), I) };
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
return o.prototype._parseMappings = function(g, I) {
|
|
786
|
-
var e, r, h, u, m = 1, f = 0, b = 0, v = 0, S = 0, B = 0, W = g.length, Z = 0, q = {}, R = [], Y = [];
|
|
787
|
-
let ee = 0;
|
|
788
|
-
for (; Z < W; ) if (g.charAt(Z) === ";") m++, Z++, f = 0, p(Y, ee), ee = Y.length;
|
|
789
|
-
else if (g.charAt(Z) === ",") Z++;
|
|
790
|
-
else {
|
|
791
|
-
for ((e = new c()).generatedLine = m, h = Z; h < W && !this._charIsMappingSeparator(g, h); h++) ;
|
|
792
|
-
for (g.slice(Z, h), r = []; Z < h; ) l.decode(g, Z, q), u = q.value, Z = q.rest, r.push(u);
|
|
793
|
-
if (r.length === 2) throw new Error("Found a source, but no line and column");
|
|
794
|
-
if (r.length === 3) throw new Error("Found a source and line, but no column");
|
|
795
|
-
if (e.generatedColumn = f + r[0], f = e.generatedColumn, r.length > 1 && (e.source = S + r[1], S += r[1], e.originalLine = b + r[2], b = e.originalLine, e.originalLine += 1, e.originalColumn = v + r[3], v = e.originalColumn, r.length > 4 && (e.name = B + r[4], B += r[4])), Y.push(e), typeof e.originalLine == "number") {
|
|
796
|
-
let x = e.source;
|
|
797
|
-
for (; R.length <= x; ) R.push(null);
|
|
798
|
-
R[x] === null && (R[x] = []), R[x].push(e);
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
p(Y, ee), this.__generatedMappings = Y;
|
|
802
|
-
for (var O = 0; O < R.length; O++) R[O] != null && a(R[O], i.compareByOriginalPositionsNoSource);
|
|
803
|
-
this.__originalMappings = [].concat(...R);
|
|
804
|
-
}, o.prototype._findMapping = function(g, I, e, r, h, u) {
|
|
805
|
-
if (g[e] <= 0) throw new TypeError("Line must be greater than or equal to 1, got " + g[e]);
|
|
806
|
-
if (g[r] < 0) throw new TypeError("Column must be greater than or equal to 0, got " + g[r]);
|
|
807
|
-
return n.search(g, I, h, u);
|
|
808
|
-
}, o.prototype.computeColumnSpans = function() {
|
|
809
|
-
for (var g = 0; g < this._generatedMappings.length; ++g) {
|
|
810
|
-
var I = this._generatedMappings[g];
|
|
811
|
-
if (g + 1 < this._generatedMappings.length) {
|
|
812
|
-
var e = this._generatedMappings[g + 1];
|
|
813
|
-
if (I.generatedLine === e.generatedLine) {
|
|
814
|
-
I.lastGeneratedColumn = e.generatedColumn - 1;
|
|
815
|
-
continue;
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
I.lastGeneratedColumn = 1 / 0;
|
|
819
|
-
}
|
|
820
|
-
}, o.prototype.originalPositionFor = function(g) {
|
|
821
|
-
var I = { generatedLine: i.getArg(g, "line"), generatedColumn: i.getArg(g, "column") }, e = this._findMapping(I, this._generatedMappings, "generatedLine", "generatedColumn", i.compareByGeneratedPositionsDeflated, i.getArg(g, "bias", t.GREATEST_LOWER_BOUND));
|
|
822
|
-
if (e >= 0) {
|
|
823
|
-
var r = this._generatedMappings[e];
|
|
824
|
-
if (r.generatedLine === I.generatedLine) {
|
|
825
|
-
var h = i.getArg(r, "source", null);
|
|
826
|
-
h !== null && (h = this._sources.at(h), h = i.computeSourceURL(this.sourceRoot, h, this._sourceMapURL));
|
|
827
|
-
var u = i.getArg(r, "name", null);
|
|
828
|
-
return u !== null && (u = this._names.at(u)), { source: h, line: i.getArg(r, "originalLine", null), column: i.getArg(r, "originalColumn", null), name: u };
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
return { source: null, line: null, column: null, name: null };
|
|
832
|
-
}, o.prototype.hasContentsOfAllSources = function() {
|
|
833
|
-
return !!this.sourcesContent && this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(g) {
|
|
834
|
-
return g == null;
|
|
835
|
-
});
|
|
836
|
-
}, o.prototype.sourceContentFor = function(g, I) {
|
|
837
|
-
if (!this.sourcesContent) return null;
|
|
838
|
-
var e = this._findSourceIndex(g);
|
|
839
|
-
if (e >= 0) return this.sourcesContent[e];
|
|
840
|
-
var r, h = g;
|
|
841
|
-
if (this.sourceRoot != null && (h = i.relative(this.sourceRoot, h)), this.sourceRoot != null && (r = i.urlParse(this.sourceRoot))) {
|
|
842
|
-
var u = h.replace(/^file:\/\//, "");
|
|
843
|
-
if (r.scheme == "file" && this._sources.has(u)) return this.sourcesContent[this._sources.indexOf(u)];
|
|
844
|
-
if ((!r.path || r.path == "/") && this._sources.has("/" + h)) return this.sourcesContent[this._sources.indexOf("/" + h)];
|
|
845
|
-
}
|
|
846
|
-
if (I) return null;
|
|
847
|
-
throw new Error('"' + h + '" is not in the SourceMap.');
|
|
848
|
-
}, o.prototype.generatedPositionFor = function(g) {
|
|
849
|
-
var I = i.getArg(g, "source");
|
|
850
|
-
if ((I = this._findSourceIndex(I)) < 0) return { line: null, column: null, lastColumn: null };
|
|
851
|
-
var e = { source: I, originalLine: i.getArg(g, "line"), originalColumn: i.getArg(g, "column") }, r = this._findMapping(e, this._originalMappings, "originalLine", "originalColumn", i.compareByOriginalPositions, i.getArg(g, "bias", t.GREATEST_LOWER_BOUND));
|
|
852
|
-
if (r >= 0) {
|
|
853
|
-
var h = this._originalMappings[r];
|
|
854
|
-
if (h.source === e.source) return { line: i.getArg(h, "generatedLine", null), column: i.getArg(h, "generatedColumn", null), lastColumn: i.getArg(h, "lastGeneratedColumn", null) };
|
|
855
|
-
}
|
|
856
|
-
return { line: null, column: null, lastColumn: null };
|
|
857
|
-
}, F.BasicSourceMapConsumer = o, C.prototype = Object.create(t.prototype), C.prototype.constructor = t, C.prototype._version = 3, Object.defineProperty(C.prototype, "sources", { get: function() {
|
|
858
|
-
for (var g = [], I = 0; I < this._sections.length; I++) for (var e = 0; e < this._sections[I].consumer.sources.length; e++) g.push(this._sections[I].consumer.sources[e]);
|
|
859
|
-
return g;
|
|
860
|
-
} }), C.prototype.originalPositionFor = function(g) {
|
|
861
|
-
var I = { generatedLine: i.getArg(g, "line"), generatedColumn: i.getArg(g, "column") }, e = n.search(I, this._sections, function(h, u) {
|
|
862
|
-
return h.generatedLine - u.generatedOffset.generatedLine || h.generatedColumn - u.generatedOffset.generatedColumn;
|
|
863
|
-
}), r = this._sections[e];
|
|
864
|
-
return r ? r.consumer.originalPositionFor({ line: I.generatedLine - (r.generatedOffset.generatedLine - 1), column: I.generatedColumn - (r.generatedOffset.generatedLine === I.generatedLine ? r.generatedOffset.generatedColumn - 1 : 0), bias: g.bias }) : { source: null, line: null, column: null, name: null };
|
|
865
|
-
}, C.prototype.hasContentsOfAllSources = function() {
|
|
866
|
-
return this._sections.every(function(g) {
|
|
867
|
-
return g.consumer.hasContentsOfAllSources();
|
|
868
|
-
});
|
|
869
|
-
}, C.prototype.sourceContentFor = function(g, I) {
|
|
870
|
-
for (var e = 0; e < this._sections.length; e++) {
|
|
871
|
-
var r = this._sections[e].consumer.sourceContentFor(g, !0);
|
|
872
|
-
if (r || r === "") return r;
|
|
873
|
-
}
|
|
874
|
-
if (I) return null;
|
|
875
|
-
throw new Error('"' + g + '" is not in the SourceMap.');
|
|
876
|
-
}, C.prototype.generatedPositionFor = function(g) {
|
|
877
|
-
for (var I = 0; I < this._sections.length; I++) {
|
|
878
|
-
var e = this._sections[I];
|
|
879
|
-
if (e.consumer._findSourceIndex(i.getArg(g, "source")) !== -1) {
|
|
880
|
-
var r = e.consumer.generatedPositionFor(g);
|
|
881
|
-
if (r) return { line: r.line + (e.generatedOffset.generatedLine - 1), column: r.column + (e.generatedOffset.generatedLine === r.line ? e.generatedOffset.generatedColumn - 1 : 0) };
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
return { line: null, column: null };
|
|
885
|
-
}, C.prototype._parseMappings = function(g, I) {
|
|
886
|
-
this.__generatedMappings = [], this.__originalMappings = [];
|
|
887
|
-
for (var e = 0; e < this._sections.length; e++) for (var r = this._sections[e], h = r.consumer._generatedMappings, u = 0; u < h.length; u++) {
|
|
888
|
-
var m = h[u], f = r.consumer._sources.at(m.source);
|
|
889
|
-
f !== null && (f = i.computeSourceURL(r.consumer.sourceRoot, f, this._sourceMapURL)), this._sources.add(f), f = this._sources.indexOf(f);
|
|
890
|
-
var b = null;
|
|
891
|
-
m.name && (b = r.consumer._names.at(m.name), this._names.add(b), b = this._names.indexOf(b));
|
|
892
|
-
var v = { source: f, generatedLine: m.generatedLine + (r.generatedOffset.generatedLine - 1), generatedColumn: m.generatedColumn + (r.generatedOffset.generatedLine === m.generatedLine ? r.generatedOffset.generatedColumn - 1 : 0), originalLine: m.originalLine, originalColumn: m.originalColumn, name: b };
|
|
893
|
-
this.__generatedMappings.push(v), typeof v.originalLine == "number" && this.__originalMappings.push(v);
|
|
894
|
-
}
|
|
895
|
-
a(this.__generatedMappings, i.compareByGeneratedPositionsDeflated), a(this.__originalMappings, i.compareByOriginalPositions);
|
|
896
|
-
}, F.IndexedSourceMapConsumer = C, F;
|
|
897
|
-
})().SourceMapConsumer, k.SourceNode = (function() {
|
|
898
|
-
if (Ne) return ae;
|
|
899
|
-
Ne = 1;
|
|
900
|
-
var i = Ge().SourceMapGenerator, n = M(), s = /(\r?\n)/, l = "$$$isSourceNode$$$";
|
|
901
|
-
function a(t, o, c, d, p) {
|
|
902
|
-
this.children = [], this.sourceContents = {}, this.line = t ?? null, this.column = o ?? null, this.source = c ?? null, this.name = p ?? null, this[l] = !0, d != null && this.add(d);
|
|
903
|
-
}
|
|
904
|
-
return a.fromStringWithSourceMap = function(t, o, c) {
|
|
905
|
-
var d = new a(), p = t.split(s), C = 0, g = function() {
|
|
906
|
-
return u() + (u() || "");
|
|
907
|
-
function u() {
|
|
908
|
-
return C < p.length ? p[C++] : void 0;
|
|
909
|
-
}
|
|
910
|
-
}, I = 1, e = 0, r = null;
|
|
911
|
-
return o.eachMapping(function(u) {
|
|
912
|
-
if (r !== null) {
|
|
913
|
-
if (!(I < u.generatedLine)) {
|
|
914
|
-
var m = (f = p[C] || "").substr(0, u.generatedColumn - e);
|
|
915
|
-
return p[C] = f.substr(u.generatedColumn - e), e = u.generatedColumn, h(r, m), void (r = u);
|
|
916
|
-
}
|
|
917
|
-
h(r, g()), I++, e = 0;
|
|
918
|
-
}
|
|
919
|
-
for (; I < u.generatedLine; ) d.add(g()), I++;
|
|
920
|
-
if (e < u.generatedColumn) {
|
|
921
|
-
var f = p[C] || "";
|
|
922
|
-
d.add(f.substr(0, u.generatedColumn)), p[C] = f.substr(u.generatedColumn), e = u.generatedColumn;
|
|
923
|
-
}
|
|
924
|
-
r = u;
|
|
925
|
-
}, this), C < p.length && (r && h(r, g()), d.add(p.splice(C).join(""))), o.sources.forEach(function(u) {
|
|
926
|
-
var m = o.sourceContentFor(u);
|
|
927
|
-
m != null && (c != null && (u = n.join(c, u)), d.setSourceContent(u, m));
|
|
928
|
-
}), d;
|
|
929
|
-
function h(u, m) {
|
|
930
|
-
if (u === null || u.source === void 0) d.add(m);
|
|
931
|
-
else {
|
|
932
|
-
var f = c ? n.join(c, u.source) : u.source;
|
|
933
|
-
d.add(new a(u.originalLine, u.originalColumn, f, m, u.name));
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
}, a.prototype.add = function(t) {
|
|
937
|
-
if (Array.isArray(t)) t.forEach(function(o) {
|
|
938
|
-
this.add(o);
|
|
939
|
-
}, this);
|
|
940
|
-
else {
|
|
941
|
-
if (!t[l] && typeof t != "string") throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + t);
|
|
942
|
-
t && this.children.push(t);
|
|
943
|
-
}
|
|
944
|
-
return this;
|
|
945
|
-
}, a.prototype.prepend = function(t) {
|
|
946
|
-
if (Array.isArray(t)) for (var o = t.length - 1; o >= 0; o--) this.prepend(t[o]);
|
|
947
|
-
else {
|
|
948
|
-
if (!t[l] && typeof t != "string") throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + t);
|
|
949
|
-
this.children.unshift(t);
|
|
950
|
-
}
|
|
951
|
-
return this;
|
|
952
|
-
}, a.prototype.walk = function(t) {
|
|
953
|
-
for (var o, c = 0, d = this.children.length; c < d; c++) (o = this.children[c])[l] ? o.walk(t) : o !== "" && t(o, { source: this.source, line: this.line, column: this.column, name: this.name });
|
|
954
|
-
}, a.prototype.join = function(t) {
|
|
955
|
-
var o, c, d = this.children.length;
|
|
956
|
-
if (d > 0) {
|
|
957
|
-
for (o = [], c = 0; c < d - 1; c++) o.push(this.children[c]), o.push(t);
|
|
958
|
-
o.push(this.children[c]), this.children = o;
|
|
959
|
-
}
|
|
960
|
-
return this;
|
|
961
|
-
}, a.prototype.replaceRight = function(t, o) {
|
|
962
|
-
var c = this.children[this.children.length - 1];
|
|
963
|
-
return c[l] ? c.replaceRight(t, o) : typeof c == "string" ? this.children[this.children.length - 1] = c.replace(t, o) : this.children.push("".replace(t, o)), this;
|
|
964
|
-
}, a.prototype.setSourceContent = function(t, o) {
|
|
965
|
-
this.sourceContents[n.toSetString(t)] = o;
|
|
966
|
-
}, a.prototype.walkSourceContents = function(t) {
|
|
967
|
-
for (var o = 0, c = this.children.length; o < c; o++) this.children[o][l] && this.children[o].walkSourceContents(t);
|
|
968
|
-
var d = Object.keys(this.sourceContents);
|
|
969
|
-
for (o = 0, c = d.length; o < c; o++) t(n.fromSetString(d[o]), this.sourceContents[d[o]]);
|
|
970
|
-
}, a.prototype.toString = function() {
|
|
971
|
-
var t = "";
|
|
972
|
-
return this.walk(function(o) {
|
|
973
|
-
t += o;
|
|
974
|
-
}), t;
|
|
975
|
-
}, a.prototype.toStringWithSourceMap = function(t) {
|
|
976
|
-
var o = { code: "", line: 1, column: 0 }, c = new i(t), d = !1, p = null, C = null, g = null, I = null;
|
|
977
|
-
return this.walk(function(e, r) {
|
|
978
|
-
o.code += e, r.source !== null && r.line !== null && r.column !== null ? (p === r.source && C === r.line && g === r.column && I === r.name || c.addMapping({ source: r.source, original: { line: r.line, column: r.column }, generated: { line: o.line, column: o.column }, name: r.name }), p = r.source, C = r.line, g = r.column, I = r.name, d = !0) : d && (c.addMapping({ generated: { line: o.line, column: o.column } }), p = null, d = !1);
|
|
979
|
-
for (var h = 0, u = e.length; h < u; h++) e.charCodeAt(h) === 10 ? (o.line++, o.column = 0, h + 1 === u ? (p = null, d = !1) : d && c.addMapping({ source: r.source, original: { line: r.line, column: r.column }, generated: { line: o.line, column: o.column }, name: r.name })) : o.column++;
|
|
980
|
-
}), this.walkSourceContents(function(e, r) {
|
|
981
|
-
c.setSourceContent(e, r);
|
|
982
|
-
}), { code: o.code, map: c };
|
|
983
|
-
}, ae.SourceNode = a, ae;
|
|
984
|
-
})().SourceNode), k);
|
|
985
|
-
class T {
|
|
986
|
-
constructor({ file: n, line: s, function: l, code: a, locals: t = {}, offender: o = !1, column: c }) {
|
|
987
|
-
y(this, "file");
|
|
988
|
-
y(this, "line");
|
|
989
|
-
y(this, "function");
|
|
990
|
-
y(this, "code");
|
|
991
|
-
y(this, "locals");
|
|
992
|
-
y(this, "offender");
|
|
993
|
-
y(this, "column");
|
|
994
|
-
this.file = n, this.line = s, this.function = l, this.code = a, this.locals = t, this.offender = o, this.column = c;
|
|
388
|
+
const B = {};
|
|
389
|
+
class X {
|
|
390
|
+
constructor({ file: e, line: t, function: i, code: n, locals: o = {}, offender: a = !1, column: r }) {
|
|
391
|
+
u(this, "file");
|
|
392
|
+
u(this, "line");
|
|
393
|
+
u(this, "function");
|
|
394
|
+
u(this, "code");
|
|
395
|
+
u(this, "locals");
|
|
396
|
+
u(this, "offender");
|
|
397
|
+
u(this, "column");
|
|
398
|
+
this.file = e, this.line = t, this.function = i, this.code = n, this.locals = o, this.offender = a, this.column = r;
|
|
995
399
|
}
|
|
996
400
|
toDict() {
|
|
997
|
-
const
|
|
998
|
-
return this.offender && (
|
|
401
|
+
const e = { file: this.file, line: this.line, function: this.function, code: this.code, locals: Object.fromEntries(Object.entries(this.locals).map(([t, i]) => [t, String(i)])) };
|
|
402
|
+
return this.offender && (e.offender = this.offender), this.column !== void 0 && (e.column = this.column), e;
|
|
999
403
|
}
|
|
1000
404
|
toJson() {
|
|
1001
405
|
return JSON.stringify(this.toDict());
|
|
1002
406
|
}
|
|
1003
407
|
}
|
|
1004
|
-
class
|
|
1005
|
-
static encode(
|
|
1006
|
-
return
|
|
408
|
+
class z {
|
|
409
|
+
static encode(e) {
|
|
410
|
+
return e instanceof X ? e.toDict() : Array.isArray(e) ? e.map((t) => z.encode(t)) : typeof e == "object" && e !== null ? JSON.stringify(e) : e;
|
|
1007
411
|
}
|
|
1008
|
-
static stringify(
|
|
1009
|
-
return JSON.stringify(
|
|
412
|
+
static stringify(e) {
|
|
413
|
+
return JSON.stringify(z.encode(e), (t, i) => i instanceof X ? i.toDict() : i);
|
|
1010
414
|
}
|
|
1011
415
|
}
|
|
1012
|
-
let
|
|
1013
|
-
function
|
|
1014
|
-
|
|
416
|
+
let N, K = 0;
|
|
417
|
+
function we(s) {
|
|
418
|
+
l().sfDebug && console.log("Initializing Exception Interceptor...");
|
|
1015
419
|
try {
|
|
1016
|
-
const
|
|
1017
|
-
if (
|
|
1018
|
-
const
|
|
1019
|
-
if (
|
|
1020
|
-
const
|
|
1021
|
-
if (["local", "dev", "development"].includes(
|
|
1022
|
-
if (["KUBERNETES_SERVICE_HOST", "AWS_EXECUTION_ENV", "ECS_CONTAINER_METADATA_URI", "ECS_CONTAINER_METADATA_URI_V4", "GAE_ENV", "K_SERVICE", "GOOGLE_CLOUD_PROJECT", "WEBSITE_INSTANCE_ID", "VERCEL", "NETLIFY", "DYNO", "RENDER", "FLY_APP_NAME", "RAILWAY_STATIC_URL", "CF_PAGES", "CLOUDFLARE"].some((
|
|
1023
|
-
const
|
|
1024
|
-
return
|
|
420
|
+
const r = (function() {
|
|
421
|
+
if (N !== void 0) return N;
|
|
422
|
+
const g = process.env || {}, c = le(g.SF_IS_LOCAL);
|
|
423
|
+
if (c !== void 0) return N = c;
|
|
424
|
+
const I = (g.SF_ENV || g.NODE_ENV || "").toLowerCase();
|
|
425
|
+
if (["local", "dev", "development"].includes(I)) return N = !0;
|
|
426
|
+
if (["KUBERNETES_SERVICE_HOST", "AWS_EXECUTION_ENV", "ECS_CONTAINER_METADATA_URI", "ECS_CONTAINER_METADATA_URI_V4", "GAE_ENV", "K_SERVICE", "GOOGLE_CLOUD_PROJECT", "WEBSITE_INSTANCE_ID", "VERCEL", "NETLIFY", "DYNO", "RENDER", "FLY_APP_NAME", "RAILWAY_STATIC_URL", "CF_PAGES", "CLOUDFLARE"].some((C) => !!g[C])) return N = !1;
|
|
427
|
+
const d = (B.hostname?.() || g.HOSTNAME || "").toLowerCase();
|
|
428
|
+
return d === "localhost" || d.endsWith(".local") || d.includes("local") ? N = !0 : N = !1;
|
|
1025
429
|
})();
|
|
1026
|
-
|
|
1027
|
-
if (
|
|
1028
|
-
|
|
1029
|
-
const
|
|
1030
|
-
if (
|
|
430
|
+
s?.setSupplementalFields?.({ isFromLocalService: r }), (async function(g) {
|
|
431
|
+
if (ge) return;
|
|
432
|
+
ge = !0;
|
|
433
|
+
const c = process.env || {};
|
|
434
|
+
if (le(c.SF_IS_LOCAL) === void 0)
|
|
1031
435
|
try {
|
|
1032
|
-
await (async function(
|
|
1033
|
-
const
|
|
1034
|
-
return (await Promise.allSettled([
|
|
1035
|
-
})(150) &&
|
|
436
|
+
await (async function(I) {
|
|
437
|
+
const d = M("http://169.254.169.254/latest/meta-data/", {}, I), C = M("http://metadata.google.internal/computeMetadata/v1/instance/", { "Metadata-Flavor": "Google" }, I), p = M("http://169.254.169.254/metadata/instance?api-version=2021-02-01", { Metadata: "true" }, I);
|
|
438
|
+
return (await Promise.allSettled([d, C, p])).some((h) => h.status === "fulfilled" && (h.value === "ok" || h.value === "http_error"));
|
|
439
|
+
})(150) && N && (N = !1, g?.setSupplementalFields?.({ isFromLocalService: !1 }));
|
|
1036
440
|
} catch {
|
|
1037
441
|
}
|
|
1038
|
-
})(
|
|
442
|
+
})(s).catch(() => {
|
|
1039
443
|
});
|
|
1040
444
|
} catch {
|
|
1041
445
|
}
|
|
1042
|
-
const n = new ke(new URL("data:application/javascript;base64,aW1wb3J0IHsgU2Vzc2lvbiB9IGZyb20gImluc3BlY3Rvci9wcm9taXNlcyI7CmltcG9ydCB7IHBhcmVudFBvcnQsIHdvcmtlckRhdGEgfSBmcm9tICJ3b3JrZXJfdGhyZWFkcyI7CgpnbG9iYWwuc2ZEZWJ1ZyA9IHVuZGVmaW5lZDsKZ2xvYmFsLnN0YWNrRGVwdGhMb2NhbHMgPSB1bmRlZmluZWQ7Cmdsb2JhbC5ub2RlTW9kdWxlc1RvQ29sbGVjdExvY2FsVmFyaWFibGVzT24gPSB1bmRlZmluZWQ7CgovKioKICogUHJvY2Vzc2VzIGNhbGwgZnJhbWVzIGZyb20gYW4gZXhjZXB0aW9uIGFuZCBwb3N0cyB0aGVtIHZpYSB0aGUgV29ya2Vy4oCZcyBwYXJlbnRQb3J0LgogKgogKiBAcGFyYW0gc2Vzc2lvbiAtIFRoZSBEZXZUb29scyBzZXNzaW9uIG9yIHNpbWlsYXIgb2JqZWN0IHlvd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5saW5lTnVtYmVyXSB8fCAiPG5vdCBjYXB0dXJlZD4iOwogICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgIGlmIChnbG9iYWwuc2ZEZWJ1ZykgewogICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoIltXb3JrZXJdIEZhaWxlZCB0byBmZXRjaCBzY3JpcHQgc291cmNlOiIsIGVycik7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIC8vIEZldGNoIGxvY2FsIHZhcmlhYmxlcyBpZiB0aGVyZSdzIGFuIG9iamVjdElkCiAgICAgICAgY29uc3QgbG9jYWxzID0gbG9jYWxTY29wZT8ub2JqZWN0Py5vYmplY3RJZAogICAgICAgICAgPyBhd2FpdCBmZXRjaExvY2FsVmFyaWFibGVzKHNlc3Npb24sIGxvY2FsU2NvcGUub2JqZWN0Lm9iamVjdElkKQogICAgICAgICAgOiB7fTsKCiAgICAgICAgcmV0dXJuIHsKICAgICAgICAgIGZ1bmN0aW9uOiBmdW5jdGlvbk5hbWUgfHwgIjxhbm9ueW1vdXM+IiwKICAgICAgICAgIGxvY2FscywKICAgICAgICAgIGZpbGUsCiAgICAgICAgICBsaW5lOiBsb2NhdGlvbj8ubGluZU51bWJlciB8fCAwLAogICAgICAgICAgY29kZSwKICAgICAgICB9OwogICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgIGlmIChnbG9iYWwuc2ZEZWJ1ZykgewogICAgICAgICAgY29uc29sZS5lcnJvcigiW1dvcmtlcl0gRXJyb3IgcHJvY2Vzc2luZyBjYWxsIGZyYW1lOiIsIGVycm9yKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHsKICAgICAgICAgIGZ1bmN0aW9uOiAiPGVycm9yPiIsCiAgICAgICAgICBsb2NhbHM6IHt9LAogICAgICAgICAgZmlsZTogIjx1bmtub3duPiIsCiAgICAgICAgICBsaW5lOiAwLAogICAgICAgICAgY29kZTogIjxub3QgY2FwdH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AllExceptions: !0 } });
|
|
1043
|
-
let
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
if (typeof
|
|
1047
|
-
const { frames:
|
|
1048
|
-
if (!
|
|
1049
|
-
const
|
|
1050
|
-
return
|
|
1051
|
-
`).slice(1).map((
|
|
1052
|
-
const
|
|
1053
|
-
if (
|
|
1054
|
-
const [,
|
|
1055
|
-
return new
|
|
446
|
+
const e = new Se(new URL("data:application/javascript;base64,aW1wb3J0IHsgU2Vzc2lvbiB9IGZyb20gImluc3BlY3Rvci9wcm9taXNlcyI7CmltcG9ydCB7IHBhcmVudFBvcnQsIHdvcmtlckRhdGEgfSBmcm9tICJ3b3JrZXJfdGhyZWFkcyI7CgpnbG9iYWwuc2ZEZWJ1ZyA9IHVuZGVmaW5lZDsKZ2xvYmFsLnN0YWNrRGVwdGhMb2NhbHMgPSB1bmRlZmluZWQ7Cmdsb2JhbC5ub2RlTW9kdWxlc1RvQ29sbGVjdExvY2FsVmFyaWFibGVzT24gPSB1bmRlZmluZWQ7CgovKioKICogUHJvY2Vzc2VzIGNhbGwgZnJhbWVzIGZyb20gYW4gZXhjZXB0aW9uIGFuZCBwb3N0cyB0aGVtIHZpYSB0aGUgV29ya2Vy4oCZcyBwYXJlbnRQb3J0LgogKgogKiBAcGFyYW0gc2Vzc2lvbiAtIFRoZSBEZXZUb29scyBzZXNzaW9uIG9yIHNpbWlsYXIgb2JqZWN0IHlvdSB1c2UgdG8gcXVlcnkgZm9yIHNjcmlwdCBzb3VyY2VzLgogKiBAcGFyYW0gY2FsbEZyYW1lcyAtIEFuIGFycmF5IG9mIGNhbGwgZnJhbWUgb2JqZWN0cy4KICogQHBhcmFtIGRlc2NyaXB0aW9uTGluZXMgLSBBbiBhcnJheSBvZiBsaW5lcyBmcm9tIHRoZSBlcnJvcuKAmXMgZGVzY3JpcHRpb24sIGVhY2ggdHlwaWNhbGx5IGJlZ2lubmluZyB3aXRoICJhdCAiLgogKiBAcmV0dXJucyB7UHJvbWlz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mw7CiAgICAgICAgfSBlbHNlIGlmIChkZXNjcmlwdGlvbkxpbmVzW2luZGV4XSkgewogICAgICAgICAgZmlsZSA9IGRlc2NyaXB0aW9uTGluZXNbaW5kZXhdLnRyaW0oKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZmlsZSA9ICI8dW5rbm93bj4iOwogICAgICAgIH0KCiAgICAgICAgLy8gSWYgd2UgaGF2ZSBhIHZhbGlkIGxvY2F0aW9uIGFuZCBzY3JpcHRJZCwgZmV0Y2ggdGhlIGNvZGUgbGluZQogICAgICAgIGlmIChsb2NhdGlvbiAmJiBsb2NhdGlvbi5zY3JpcHRJZCkgewogICAgICAgICAgY29uc3Qgc2NyaXB0SWQgPSBsb2NhdGlvbi5zY3JpcHRJZDsKICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgIGNvbnN0IHsgc2NyaXB0U291cmNlIH0gPSBhd2FpdCBzZXNzaW9uLnBvc3QoCiAgICAgICAgICAgICAgIkRlYnVnZ2VyLmdldFNjcmlwdFNvdXJjZSIsCiAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc2NyaXB0SWQsCiAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgKTsKICAgICAgICAgICAgY29uc3Qgc291cmNlTGluZXMgPSBzY3JpcHRTb3VyY2Uuc3BsaXQoIlxuIik7CiAgICAgICAgICAgIGNvZGUgPSBzb3VyY2VMaW5lc1tsb2NhdGlvbi5saW5lTnVtYmVyXSB8fCAiPG5vdCBjYXB0dXJlZD4iOwogICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgIGlmIChnbG9iYWwuc2ZEZWJ1ZykgewogICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoIltXb3JrZXJdIEZhaWxlZCB0byBmZXRjaCBzY3JpcHQgc291cmNlOiIsIGVycik7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIC8vIEZldGNoIGxvY2FsIHZhcmlhYmxlcyBpZiB0aGVyZSdzIGFuIG9iamVjdElkCiAgICAgICAgY29uc3QgbG9jYWxzID0gbG9jYWxTY29wZT8ub2JqZWN0Py5vYmplY3RJZAogICAgICAgICAgPyBhd2FpdCBmZXRjaExvY2FsVmFyaWFibGVzKHNlc3Npb24sIGxvY2FsU2NvcGUub2JqZWN0Lm9iamVjdElkKQogICAgICAgICAgOiB7fTsKCiAgICAgICAgcmV0dXJuIHsKICAgICAgICAgIGZ1bmN0aW9uOiBmdW5jdGlvbk5hbWUgfHwgIjxhbm9ueW1vdXM+IiwKICAgICAgICAgIGxvY2FscywKICAgICAgICAgIGZpbGUsCiAgICAgICAgICBsaW5lOiBsb2NhdGlvbj8ubGluZU51bWJlciB8fCAwLAogICAgICAgICAgY29kZSwKICAgICAgICB9OwogICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgIGlmIChnbG9iYWwuc2ZEZWJ1ZykgewogICAgICAgICAgY29uc29sZS5lcnJvcigiW1dvcmtlcl0gRXJyb3IgcHJvY2Vzc2luZyBjYWxsIGZyYW1lOiIsIGVycm9yKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHsKICAgICAgICAgIGZ1bmN0aW9uOiAiPGVycm9yPiIsCiAgICAgICAgICBsb2NhbHM6IHt9LAogICAgICAgICAgZmlsZTogIjx1bmtub3duPiIsCiAgICAgICAgICBsaW5lOiAwLAogICAgICAgICAgY29kZTogIjxub3QgY2FwdHVyZWQ+IiwKICAgICAgICB9OwogICAgICB9CiAgICB9KSwKICApOwogIC8vIFBvc3QgZXhjZXB0aW9uIGRhdGEKICBwYXJlbnRQb3J0Py5wb3N0TWVzc2FnZSh7IHR5cGU6ICJleGNlcHRpb24iLCBmcmFtZXMgfSk7Cn0KCi8qKgogKiBIYW5kbGVzIHRoZSAicGF1c2VkIiBzdGF0ZSBvZiB0aGUgZGVidWdnZXIgYW5kIHByb2Nlc3NlcyBleGNlcHRpb25zIG9yIHByb21pc2UgcmVqZWN0aW9ucy4KICogQHBhc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PT09ICJPYmplY3QiCiAgICAgICAgKSB7CiAgICAgICAgICBjb25zdCBpZCA9IHByb3AudmFsdWUub2JqZWN0SWQ7CiAgICAgICAgICBhd2FpdCB1bnJvbGxPYmplY3Qoc2Vzc2lvbiwgaWQsIHByb3AubmFtZSwgdmFyaWFibGVzKTsKICAgICAgICB9IGVsc2UgaWYgKHByb3A/LnZhbHVlKSB7CiAgICAgICAgICB1bnJvbGxPdGhlcihwcm9wLCB2YXJpYWJsZXMpOwogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gdmFyaWFibGVzOwogICAgfQogIH0gY2F0Y2ggKGVycikgewogICAgaWYgKGdsb2JhbC5zZkRlYnVnKSB7CiAgICAgIGNvbnNvbGUuZXJyb3IoIltXb3JrZXJdIEZhaWxlZCB0byBmZXRjaCBsb2NhbCB2YXJpYWJsZXM6IiwgZXJyKTsKICAgIH0KICAgIHJldHVybiB7fTsKICB9Cn0KCnN0YXJ0RGVidWdnZXIoKS5jYXRjaCgoZXJyb3IpID0+IHsKICBpZiAoZ2xvYmFsLnNmRGVidWcpIHsKICAgIGNvbnNvbGUuZXJyb3IoIltXb3JrZXJdIEZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlcjoiLCBlcnJvcik7CiAgfQp9KTsKCi8vIEtlZXAgdGhlIHdvcmtlciBhbGl2ZQpzZXRJbnRlcnZhbCgoKSA9PiB7fSwgMTAwMDApOwo="), { workerData: { captureAllExceptions: !0 } });
|
|
447
|
+
let t = null;
|
|
448
|
+
const i = /* @__PURE__ */ new WeakMap();
|
|
449
|
+
e.on("message", (r) => {
|
|
450
|
+
if (typeof r == "string" && l().sfDebug && console.log(`[Worker] ${r}`), r.readyToGetParameters && e.postMessage({ sfDebug: l().sfDebug, stackDepthLocals: l().stackDepthLocals, nodeModulesToCollectLocalVariablesOn: l().nodeModulesToCollectLocalVariablesOn }), r.type === "exception") {
|
|
451
|
+
const { frames: g } = r, c = t;
|
|
452
|
+
if (!c) return;
|
|
453
|
+
const I = i.get(c), d = (function(p) {
|
|
454
|
+
return p ? p.split(`
|
|
455
|
+
`).slice(1).map((h) => {
|
|
456
|
+
const A = /at (.+?) \((.+):(\d+):(\d+)\)/.exec(h) || /at (.+):(\d+):(\d+)/.exec(h);
|
|
457
|
+
if (A) {
|
|
458
|
+
const [, b, Z, f, m] = A;
|
|
459
|
+
return new X({ function: b || "<anonymous>", locals: {}, file: Z || "<unknown>", line: parseInt(f, 10) || 0, code: "<not captured>", column: parseInt(m) || 0 });
|
|
1056
460
|
}
|
|
1057
|
-
return new
|
|
461
|
+
return new X({ function: "<unknown>", locals: {}, file: "<unknown>", line: 0, code: "<not captured>", column: 0 });
|
|
1058
462
|
}) : [];
|
|
1059
|
-
})(
|
|
1060
|
-
const
|
|
1061
|
-
let
|
|
1062
|
-
for (let f = 0; f <
|
|
1063
|
-
const
|
|
1064
|
-
if (
|
|
1065
|
-
for (let
|
|
1066
|
-
const
|
|
1067
|
-
if (
|
|
1068
|
-
|
|
463
|
+
})(c.stack), C = (function(p, h) {
|
|
464
|
+
const A = [];
|
|
465
|
+
let b = -1, Z = -1;
|
|
466
|
+
for (let f = 0; f < p.length; f++) {
|
|
467
|
+
const m = Re(p[f].file);
|
|
468
|
+
if (Z = f, m !== "<unknown>") {
|
|
469
|
+
for (let y = 0; y < h.length; y++) {
|
|
470
|
+
const x = h[y];
|
|
471
|
+
if (be(x, m) || typeof x.file == "string" && x.file.includes(m)) {
|
|
472
|
+
b = y, K = 0, l().sfDebug && console.log(`✅ Matched Frame Found: ${m} @ Debugger Frame ${y}`);
|
|
1069
473
|
break;
|
|
1070
474
|
}
|
|
1071
475
|
}
|
|
1072
|
-
if (
|
|
476
|
+
if (b !== -1) break;
|
|
1073
477
|
}
|
|
1074
478
|
}
|
|
1075
|
-
if (
|
|
1076
|
-
|
|
1077
|
-
for (let f = 0; f <
|
|
1078
|
-
const
|
|
1079
|
-
|
|
479
|
+
if (b === -1) return K === 10 ? (K = 0, p) : (++K, l().sfDebug && console.log(`"❌ No matching frame found. Checking once again, Attempt N ${K}"`), []);
|
|
480
|
+
l().sfDebug && console.log(`🔄 Merging from matched index ${b} onward...`);
|
|
481
|
+
for (let f = 0; f < h.length; f++) {
|
|
482
|
+
const m = p[Z + f], y = h[b + f];
|
|
483
|
+
A.push(new X({ function: y?.function || m?.function || "<anonymous>", locals: y?.locals || m?.locals || {}, file: m?.file || y?.file || "<unknown>", line: y?.line || m?.line || 0, code: y?.code || m?.code || "<not captured>" }));
|
|
1080
484
|
}
|
|
1081
|
-
return
|
|
1082
|
-
})(
|
|
1083
|
-
if (
|
|
1084
|
-
|
|
1085
|
-
const
|
|
1086
|
-
for (let
|
|
1087
|
-
const
|
|
1088
|
-
|
|
485
|
+
return A;
|
|
486
|
+
})(d, g || []);
|
|
487
|
+
if (C.length !== 0) {
|
|
488
|
+
t = null;
|
|
489
|
+
const p = l().stackDepthCodeTraceDepth, h = p === -1 ? C : C.slice(0, p + 1), A = Math.min(h.length, d.length);
|
|
490
|
+
for (let m = 0; m < A; m++) (async () => {
|
|
491
|
+
const y = He(h[m].file, d[m].line, d[m].column);
|
|
492
|
+
y && (y.content != null && (h[m].code = y.content), y.file != null && (h[m].file = y.file));
|
|
1089
493
|
})();
|
|
1090
|
-
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
const
|
|
1094
|
-
f ? (
|
|
1095
|
-
|
|
1096
|
-
})) :
|
|
1097
|
-
|
|
1098
|
-
}) :
|
|
494
|
+
s.setOperationName("CollectExceptions");
|
|
495
|
+
const b = c.message ? `${c.name}: ${c.message}` : c.name;
|
|
496
|
+
l().sfDebug && console.log("error message is : ", b);
|
|
497
|
+
const Z = G.getInstance(), f = i.get(c);
|
|
498
|
+
f ? (Z.setTraceIdFor(f, f), Z.runWithSession(f, () => {
|
|
499
|
+
Z.setTraceId(f), s.doSend(b, h);
|
|
500
|
+
})) : s.doSend(b, h), I ? G.getInstance().runWithSession(I, () => {
|
|
501
|
+
s.doSend(b, h);
|
|
502
|
+
}) : s.doSend(b, h);
|
|
1099
503
|
}
|
|
1100
504
|
}
|
|
1101
|
-
}),
|
|
1102
|
-
console.error("[Worker Error]",
|
|
1103
|
-
}),
|
|
1104
|
-
console.error(`[Worker] Exited with code ${
|
|
1105
|
-
}),
|
|
1106
|
-
const
|
|
1107
|
-
function
|
|
1108
|
-
const
|
|
1109
|
-
Reflect.setPrototypeOf(
|
|
505
|
+
}), e.on("error", (r) => {
|
|
506
|
+
console.error("[Worker Error]", r);
|
|
507
|
+
}), e.on("exit", (r) => {
|
|
508
|
+
console.error(`[Worker] Exited with code ${r}`);
|
|
509
|
+
}), e.unref();
|
|
510
|
+
const n = Error, o = /* @__PURE__ */ new Set();
|
|
511
|
+
function a(...r) {
|
|
512
|
+
const g = Reflect.construct(n, r);
|
|
513
|
+
Reflect.setPrototypeOf(g, a.prototype);
|
|
1110
514
|
try {
|
|
1111
|
-
const
|
|
1112
|
-
|
|
515
|
+
const I = G.getInstance().getTraceId();
|
|
516
|
+
i.set(g, I);
|
|
1113
517
|
} catch {
|
|
1114
518
|
}
|
|
1115
|
-
|
|
1116
|
-
const
|
|
519
|
+
n.captureStackTrace && n.captureStackTrace(g, a);
|
|
520
|
+
const c = `${g.message}:${g.stack?.split(`
|
|
1117
521
|
`)[1]?.trim()}`;
|
|
1118
|
-
if (!
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1121
|
-
|
|
522
|
+
if (!o.has(c)) {
|
|
523
|
+
o.add(c), t = g;
|
|
524
|
+
const I = G.getInstance().getTraceId();
|
|
525
|
+
i.set(g, I), e.postMessage({ type: "processException", error: g.message });
|
|
1122
526
|
}
|
|
1123
|
-
return
|
|
527
|
+
return g;
|
|
1124
528
|
}
|
|
1125
|
-
|
|
529
|
+
a.prototype = Object.create(n.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), Object.setPrototypeOf(a, n), globalThis.Error = a;
|
|
1126
530
|
}
|
|
1127
|
-
function
|
|
1128
|
-
return
|
|
531
|
+
function ce(s) {
|
|
532
|
+
return s = (s = (s = s.replace(/^webpack:\/\/[^\/]+\/\.?\//, "")).replace(/^.*\/pages\//, "pages/")).replace(/\.(js|ts)$/, "");
|
|
1129
533
|
}
|
|
1130
|
-
function
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1133
|
-
const
|
|
1134
|
-
return
|
|
1135
|
-
})(
|
|
1136
|
-
if (!
|
|
1137
|
-
const
|
|
534
|
+
function He(s, e, t) {
|
|
535
|
+
const i = (function(o) {
|
|
536
|
+
o.startsWith("at ") && (o = o.slice(3).trim());
|
|
537
|
+
const a = o.match(/^(.*?)(:\d+)+(\.map)?$/);
|
|
538
|
+
return a ? a[1] : o;
|
|
539
|
+
})(s);
|
|
540
|
+
if (!i || i === "<unknown>") return null;
|
|
541
|
+
const n = i + ".map";
|
|
1138
542
|
try {
|
|
1139
|
-
const
|
|
1140
|
-
if (
|
|
1141
|
-
const
|
|
1142
|
-
let
|
|
1143
|
-
if (
|
|
1144
|
-
const
|
|
1145
|
-
if (
|
|
543
|
+
const o = ue(n, "utf-8");
|
|
544
|
+
if (o) {
|
|
545
|
+
const a = JSON.parse(o);
|
|
546
|
+
let r = new Ce.SourceMapConsumer(a).originalPositionFor({ line: e, column: t });
|
|
547
|
+
if (i && r.source) {
|
|
548
|
+
const g = ce(i), c = a.sources.findIndex((I) => ce(I) === g);
|
|
549
|
+
if (c === -1) l().sfDebug && console.log(`Source file "${i}" not found in the source map.`);
|
|
1146
550
|
else {
|
|
1147
|
-
const
|
|
1148
|
-
if (
|
|
1149
|
-
return { content:
|
|
1150
|
-
`).slice(
|
|
1151
|
-
`), name:
|
|
1152
|
-
|
|
551
|
+
const I = a.sourcesContent[c], d = a.names.join(",");
|
|
552
|
+
if (I)
|
|
553
|
+
return { content: I.split(`
|
|
554
|
+
`).slice(r.line - 1, r.line + 20).join(`
|
|
555
|
+
`), name: d, file: r.source };
|
|
556
|
+
l().sfDebug && console.log(`No source content available for file "${i}".`);
|
|
1153
557
|
}
|
|
1154
558
|
}
|
|
1155
|
-
return { content:
|
|
559
|
+
return { content: a.sourcesContent[0], name: a.names[0], file: a.file };
|
|
1156
560
|
}
|
|
1157
|
-
} catch (
|
|
1158
|
-
|
|
561
|
+
} catch (o) {
|
|
562
|
+
l().sfDebug && console.log(`Cant read/parse "${n}: Error - ".`, o);
|
|
1159
563
|
}
|
|
1160
564
|
return null;
|
|
1161
565
|
}
|
|
1162
|
-
function
|
|
1163
|
-
return
|
|
566
|
+
function Re(s) {
|
|
567
|
+
return s?.split("/").pop() || "<unknown>";
|
|
1164
568
|
}
|
|
1165
|
-
function
|
|
1166
|
-
if (!
|
|
1167
|
-
for (const
|
|
1168
|
-
if (typeof
|
|
569
|
+
function be(s, e) {
|
|
570
|
+
if (!s || typeof s != "object") return !1;
|
|
571
|
+
for (const t of Object.values(s))
|
|
572
|
+
if (typeof t == "string" && t.includes(e) || typeof t == "object" && be(t, e)) return !0;
|
|
1169
573
|
return !1;
|
|
1170
574
|
}
|
|
1171
|
-
let
|
|
1172
|
-
function
|
|
1173
|
-
if (!
|
|
1174
|
-
const
|
|
1175
|
-
return !!["1", "true", "yes", "on"].includes(
|
|
575
|
+
let ge = !1;
|
|
576
|
+
function le(s) {
|
|
577
|
+
if (!s) return;
|
|
578
|
+
const e = s.toLowerCase().trim();
|
|
579
|
+
return !!["1", "true", "yes", "on"].includes(e) || !["0", "false", "no", "off"].includes(e) && void 0;
|
|
1176
580
|
}
|
|
1177
|
-
function
|
|
1178
|
-
return new Promise((
|
|
581
|
+
function M(s, e, t) {
|
|
582
|
+
return new Promise((i) => {
|
|
1179
583
|
try {
|
|
1180
|
-
const
|
|
1181
|
-
|
|
584
|
+
const n = new URL(s), o = (n.protocol, B).request({ method: "GET", hostname: n.hostname, port: n.port || (n.protocol === "https:" ? 443 : 80), path: n.pathname + (n.search || ""), headers: e }, (a) => {
|
|
585
|
+
a.resume(), a.statusCode && a.statusCode >= 200 && a.statusCode < 400 ? i("ok") : i("http_error");
|
|
1182
586
|
});
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
}),
|
|
587
|
+
o.on("error", () => i("error")), o.setTimeout(t, () => {
|
|
588
|
+
o.destroy(), i("timeout");
|
|
589
|
+
}), o.end();
|
|
1186
590
|
} catch {
|
|
1187
|
-
|
|
591
|
+
i("error");
|
|
1188
592
|
}
|
|
1189
593
|
});
|
|
1190
594
|
}
|
|
1191
|
-
class
|
|
595
|
+
class Ye extends R {
|
|
1192
596
|
constructor() {
|
|
1193
597
|
super();
|
|
1194
|
-
|
|
1195
|
-
|
|
598
|
+
u(this, "serviceIdentifier", new T());
|
|
599
|
+
u(this, "supplementalFields", {});
|
|
1196
600
|
this.setOperationName("CollectExceptions");
|
|
1197
601
|
}
|
|
1198
|
-
setSupplementalFields(
|
|
1199
|
-
this.supplementalFields = { ...this.supplementalFields, ...
|
|
602
|
+
setSupplementalFields(t) {
|
|
603
|
+
this.supplementalFields = { ...this.supplementalFields, ...t };
|
|
1200
604
|
}
|
|
1201
605
|
normalizedSupplementalForGraphQL() {
|
|
1202
|
-
const { isFromLocalService:
|
|
1203
|
-
return
|
|
606
|
+
const { isFromLocalService: t } = this.supplementalFields, i = {};
|
|
607
|
+
return t !== void 0 && (i.isFromLocalService = t), i;
|
|
1204
608
|
}
|
|
1205
609
|
async sendAppIdentifier() {
|
|
1206
610
|
this.serviceIdentifier.doSend({});
|
|
1207
611
|
}
|
|
1208
|
-
async doSend(
|
|
1209
|
-
this.sendAppIdentifier(), this.send(
|
|
612
|
+
async doSend(t, i) {
|
|
613
|
+
this.sendAppIdentifier(), this.send(t, i);
|
|
1210
614
|
}
|
|
1211
|
-
async send(
|
|
1212
|
-
|
|
1213
|
-
const
|
|
1214
|
-
|
|
615
|
+
async send(t, i) {
|
|
616
|
+
l().sfDebug && console.log(" SENDING EXCEPTION...");
|
|
617
|
+
const n = JSON.stringify(z.encode(i)), o = this.normalizedSupplementalForGraphQL(), a = this.getVariables({ exceptionMessage: t, traceJson: n, reentrancyGuardPreactive: !1, library: l().packageLibraryType, version: l().version, ...o });
|
|
618
|
+
F(this.endpoint, this.operationName, this.getQuery(), a);
|
|
1215
619
|
}
|
|
1216
620
|
getQuery() {
|
|
1217
621
|
return `
|
|
@@ -1225,7 +629,8 @@ class ct extends E {
|
|
|
1225
629
|
$library: String!,
|
|
1226
630
|
$timestampMs: String!,
|
|
1227
631
|
$version: String!,
|
|
1228
|
-
$isFromLocalService: Boolean
|
|
632
|
+
$isFromLocalService: Boolean,
|
|
633
|
+
$parentSpanId: String
|
|
1229
634
|
) {
|
|
1230
635
|
${this.queryName}(
|
|
1231
636
|
apiKey: $apiKey,
|
|
@@ -1237,58 +642,59 @@ class ct extends E {
|
|
|
1237
642
|
library: $library,
|
|
1238
643
|
timestampMs: $timestampMs,
|
|
1239
644
|
version: $version,
|
|
1240
|
-
isFromLocalService: $isFromLocalService
|
|
645
|
+
isFromLocalService: $isFromLocalService,
|
|
646
|
+
parentSpanId: $parentSpanId
|
|
1241
647
|
)
|
|
1242
648
|
}
|
|
1243
649
|
`;
|
|
1244
650
|
}
|
|
1245
651
|
}
|
|
1246
|
-
const
|
|
1247
|
-
var
|
|
1248
|
-
const
|
|
1249
|
-
let
|
|
1250
|
-
function
|
|
1251
|
-
const
|
|
1252
|
-
if (
|
|
1253
|
-
let
|
|
1254
|
-
|
|
652
|
+
const Ie = "getting request source code";
|
|
653
|
+
var L = ((s) => (s.UNKNOWN = "unknown", s.ANONYMOUS = "anonymous", s.NOT_CAPTURED = "not captured", s))(L || {});
|
|
654
|
+
const j = "http:", Q = "https:";
|
|
655
|
+
let de = !1;
|
|
656
|
+
function Ke() {
|
|
657
|
+
const s = l().sfDebug;
|
|
658
|
+
if (de) return void (s && console.log("[patchNodeHttpInbound] Already installed, skipping."));
|
|
659
|
+
let e;
|
|
660
|
+
de = !0;
|
|
1255
661
|
try {
|
|
1256
|
-
|
|
1257
|
-
} catch (
|
|
1258
|
-
return void console.error("Failed to require node:http:",
|
|
1259
|
-
}
|
|
1260
|
-
if (!
|
|
1261
|
-
const
|
|
1262
|
-
|
|
1263
|
-
if (
|
|
1264
|
-
const
|
|
1265
|
-
const
|
|
1266
|
-
if (!
|
|
1267
|
-
for (const [
|
|
1268
|
-
return
|
|
1269
|
-
})(
|
|
1270
|
-
|
|
1271
|
-
const
|
|
1272
|
-
|
|
1273
|
-
const
|
|
1274
|
-
return
|
|
1275
|
-
|
|
1276
|
-
const
|
|
1277
|
-
|
|
662
|
+
e = require("node:http"), s && console.log("[patchNodeHttpInbound] node:http required successfully.");
|
|
663
|
+
} catch (n) {
|
|
664
|
+
return void console.error("Failed to require node:http:", n);
|
|
665
|
+
}
|
|
666
|
+
if (!e?.Server?.prototype) return void (s && console.log("[patchNodeHttpInbound] http.Server.prototype not found."));
|
|
667
|
+
const t = e.Server.prototype, i = t.emit;
|
|
668
|
+
i && !t.__sf_inbound_patched__ ? (Object.defineProperty(t, "__sf_inbound_patched__", { value: !0, enumerable: !1, configurable: !1, writable: !1 }), s && console.log("[patchNodeHttpInbound] Patching http.Server.prototype.emit."), t.emit = function(n, ...o) {
|
|
669
|
+
if (n !== "request") return s && console.log(`[patchNodeHttpInbound] Passing through event: ${n}`), i.call(this, n, ...o);
|
|
670
|
+
const a = o[0], r = o[1], g = (function(C) {
|
|
671
|
+
const p = {};
|
|
672
|
+
if (!C) return p;
|
|
673
|
+
for (const [h, A] of Object.entries(C)) A != null && (Array.isArray(A) ? p[h.toLowerCase()] = A.join(", ") : p[h.toLowerCase()] = String(A));
|
|
674
|
+
return p;
|
|
675
|
+
})(a?.headers), c = g["x-sf3-rid"];
|
|
676
|
+
s && (console.log("[patchNodeHttpInbound] Intercepted request event."), console.log("[patchNodeHttpInbound] Inbound headers:", g), console.log("[patchNodeHttpInbound] Trace header:", c));
|
|
677
|
+
const I = G.getInstance();
|
|
678
|
+
I.setTraceId(c);
|
|
679
|
+
const d = I.getTraceId();
|
|
680
|
+
return s && console.log("[patchNodeHttpInbound] Context traceId set:", d), I.runWith({ inboundHeaders: g, ...c ? { traceId: c } : {} }, () => {
|
|
681
|
+
c && I.setTraceId(c), s && console.log("[patchNodeHttpInbound] Running request handler in context.");
|
|
682
|
+
const C = () => {
|
|
683
|
+
s && console.log("[patchNodeHttpInbound] Response finished/closed for traceId:", I.getTraceId());
|
|
1278
684
|
};
|
|
1279
|
-
return
|
|
685
|
+
return r.on("finish", C), r.on("close", C), i.call(this, n, a, r);
|
|
1280
686
|
});
|
|
1281
|
-
}) :
|
|
687
|
+
}) : s && console.log("[patchNodeHttpInbound] Already patched, skipping.");
|
|
1282
688
|
}
|
|
1283
|
-
class
|
|
689
|
+
class Ue extends ne {
|
|
1284
690
|
constructor() {
|
|
1285
691
|
super(), this.setOperationName("DomainsToNotPassHeaderTo");
|
|
1286
692
|
}
|
|
1287
|
-
async doSend(
|
|
1288
|
-
this.sendAppIdentifier(), this.send(
|
|
693
|
+
async doSend(e) {
|
|
694
|
+
this.sendAppIdentifier(), this.send(e);
|
|
1289
695
|
}
|
|
1290
|
-
async send(
|
|
1291
|
-
const
|
|
696
|
+
async send(e) {
|
|
697
|
+
const t = `
|
|
1292
698
|
${this.queryType} ${this.operationName}(
|
|
1293
699
|
$apiKey: String!,
|
|
1294
700
|
$serviceUuid: String!,
|
|
@@ -1300,25 +706,25 @@ class gt extends de {
|
|
|
1300
706
|
domains: $domains
|
|
1301
707
|
)
|
|
1302
708
|
}
|
|
1303
|
-
`,
|
|
1304
|
-
|
|
709
|
+
`, i = { apiKey: this.apiKey, serviceUuid: this.serviceUUID, domains: e };
|
|
710
|
+
F(this.endpoint, this.operationName, t, i);
|
|
1305
711
|
}
|
|
1306
712
|
}
|
|
1307
|
-
class
|
|
713
|
+
class Xe extends R {
|
|
1308
714
|
constructor() {
|
|
1309
715
|
super();
|
|
1310
|
-
|
|
716
|
+
u(this, "serviceIdentifier", new T());
|
|
1311
717
|
this.setOperationName("CollectNetworkHops");
|
|
1312
718
|
}
|
|
1313
719
|
async sendAppIdentifier() {
|
|
1314
720
|
this.serviceIdentifier.doSend({});
|
|
1315
721
|
}
|
|
1316
|
-
async doSend(
|
|
1317
|
-
this.sendAppIdentifier(), this.send(
|
|
722
|
+
async doSend(t) {
|
|
723
|
+
this.sendAppIdentifier(), this.send(t);
|
|
1318
724
|
}
|
|
1319
|
-
async send(
|
|
1320
|
-
const { name:
|
|
1321
|
-
|
|
725
|
+
async send(t) {
|
|
726
|
+
const { name: i, column: n, line: o, entrypoint: a, retryWithoutTraceId: r } = t, g = this.getVariables({ name: i, column: n, line: o, entrypoint: a, retryWithoutTraceId: r });
|
|
727
|
+
F(this.endpoint, this.operationName, this.getQuery(), g);
|
|
1322
728
|
}
|
|
1323
729
|
getQuery() {
|
|
1324
730
|
return `
|
|
@@ -1348,17 +754,17 @@ class ut extends E {
|
|
|
1348
754
|
`;
|
|
1349
755
|
}
|
|
1350
756
|
}
|
|
1351
|
-
class
|
|
757
|
+
class Je extends R {
|
|
1352
758
|
constructor() {
|
|
1353
759
|
super();
|
|
1354
|
-
|
|
760
|
+
u(this, "serviceIdentifier", new T());
|
|
1355
761
|
this.setOperationName("CollectNetworkRequest");
|
|
1356
762
|
}
|
|
1357
763
|
async sendAppIdentifier() {
|
|
1358
764
|
this.serviceIdentifier.doSend({});
|
|
1359
765
|
}
|
|
1360
|
-
async doSend(
|
|
1361
|
-
this.sendAppIdentifier(), this.send(
|
|
766
|
+
async doSend(t) {
|
|
767
|
+
this.sendAppIdentifier(), this.send(t);
|
|
1362
768
|
}
|
|
1363
769
|
getQuery() {
|
|
1364
770
|
return `
|
|
@@ -1370,182 +776,182 @@ class dt extends E {
|
|
|
1370
776
|
}
|
|
1371
777
|
`;
|
|
1372
778
|
}
|
|
1373
|
-
async send(
|
|
1374
|
-
const
|
|
1375
|
-
await
|
|
779
|
+
async send(t) {
|
|
780
|
+
const i = { data: { ...t } };
|
|
781
|
+
await F(this.endpoint, this.operationName, this.getQuery(), i);
|
|
1376
782
|
}
|
|
1377
783
|
}
|
|
1378
|
-
const
|
|
1379
|
-
class
|
|
1380
|
-
constructor(
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
this.contextManager =
|
|
1387
|
-
typeof
|
|
1388
|
-
}),
|
|
1389
|
-
}
|
|
1390
|
-
extractIdsFromTraceHeader(
|
|
1391
|
-
let
|
|
1392
|
-
if (
|
|
784
|
+
const q = [400, 403];
|
|
785
|
+
class Te {
|
|
786
|
+
constructor(e = []) {
|
|
787
|
+
u(this, "HEADER_TRACING", "X-Sf3-Rid");
|
|
788
|
+
u(this, "HEADER_LOG_GUARD", "reentrancy_guard_logging_preactive");
|
|
789
|
+
u(this, "HEADER_PRINT_GUARD", "reentrancy_guard_print_preactive");
|
|
790
|
+
u(this, "HEADER_EXCEPTION_GUARD", "reentrancy_guard_exception_preactive");
|
|
791
|
+
u(this, "contextManager");
|
|
792
|
+
this.contextManager = G.getInstance(), e?.forEach((t) => {
|
|
793
|
+
typeof t == "string" && t.trim() && this.contextManager.getExcludedDomains().add(t);
|
|
794
|
+
}), l().sfDebug && console.log("[RequestInterceptor] Initialized with static excluded domains.");
|
|
795
|
+
}
|
|
796
|
+
extractIdsFromTraceHeader(e, t = this.HEADER_TRACING) {
|
|
797
|
+
let i;
|
|
798
|
+
if (e instanceof Headers) i = e.get(t) ?? void 0;
|
|
1393
799
|
else {
|
|
1394
|
-
const
|
|
1395
|
-
for (const [
|
|
1396
|
-
|
|
800
|
+
const o = t.toLowerCase();
|
|
801
|
+
for (const [a, r] of Object.entries(e)) if (a.toLowerCase() === o) {
|
|
802
|
+
i = r;
|
|
1397
803
|
break;
|
|
1398
804
|
}
|
|
1399
805
|
}
|
|
1400
|
-
if (!
|
|
1401
|
-
const
|
|
1402
|
-
return
|
|
1403
|
-
}
|
|
1404
|
-
parseStackFrame(
|
|
1405
|
-
const
|
|
1406
|
-
if (!
|
|
1407
|
-
const [,
|
|
1408
|
-
return { filePath:
|
|
1409
|
-
}
|
|
1410
|
-
async getOriginalPosition(
|
|
1411
|
-
let
|
|
1412
|
-
const
|
|
806
|
+
if (!i) return {};
|
|
807
|
+
const n = i.split("/").filter(Boolean);
|
|
808
|
+
return n.length < 3 ? {} : { sessionId: n[0], pageVisitId: n[1], requestId: n[n.length - 1] };
|
|
809
|
+
}
|
|
810
|
+
parseStackFrame(e) {
|
|
811
|
+
const t = /\((.*):(\d+):(\d+)\)$/.exec(e.trim());
|
|
812
|
+
if (!t) return null;
|
|
813
|
+
const [, i, n, o] = t;
|
|
814
|
+
return { filePath: i, line: parseInt(n, 10), column: parseInt(o, 10) };
|
|
815
|
+
}
|
|
816
|
+
async getOriginalPosition(e, t, i) {
|
|
817
|
+
let n = { source: e, line: t, column: i, name: null };
|
|
818
|
+
const o = e + ".map";
|
|
1413
819
|
try {
|
|
1414
|
-
const
|
|
1415
|
-
let
|
|
1416
|
-
|
|
1417
|
-
} catch (
|
|
1418
|
-
|
|
820
|
+
const a = JSON.parse(ue(o, "utf-8"));
|
|
821
|
+
let r = (await new Ce.SourceMapConsumer(a)).originalPositionFor({ line: t, column: i });
|
|
822
|
+
r.source && (n = r);
|
|
823
|
+
} catch (a) {
|
|
824
|
+
l().sfDebug && console.error(`Could not read/parse map file at ${o}:`, a);
|
|
1419
825
|
}
|
|
1420
|
-
return { originalPos:
|
|
1421
|
-
}
|
|
1422
|
-
captureFirstUserLines(
|
|
1423
|
-
const
|
|
1424
|
-
Error.stackTraceLimit = Math.max(
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1427
|
-
const
|
|
1428
|
-
Error.stackTraceLimit =
|
|
1429
|
-
const
|
|
1430
|
-
`).slice(1),
|
|
1431
|
-
for (const
|
|
1432
|
-
if (!(
|
|
1433
|
-
for (const
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1436
|
-
const { originalPos:
|
|
1437
|
-
if (
|
|
1438
|
-
|
|
1439
|
-
const
|
|
1440
|
-
|
|
826
|
+
return { originalPos: n };
|
|
827
|
+
}
|
|
828
|
+
captureFirstUserLines(e, t = 10, i = !1) {
|
|
829
|
+
const n = l().sfDebug ? 10 : t, o = Error.stackTraceLimit;
|
|
830
|
+
Error.stackTraceLimit = Math.max(o, n);
|
|
831
|
+
const a = new Error(Ie);
|
|
832
|
+
Ie in Error && Error.captureStackTrace(a, this.captureFirstUserLines);
|
|
833
|
+
const r = a.stack || "";
|
|
834
|
+
Error.stackTraceLimit = o;
|
|
835
|
+
const g = r.split(`
|
|
836
|
+
`).slice(1), c = [];
|
|
837
|
+
for (const I of g)
|
|
838
|
+
if (!(I.includes("node:internal") || I.includes("internal/modules") || I.includes("internal/process") || I.includes("node_modules") || I.includes(".next/server/chunks") || I.includes("RequestInterceptor") || I.includes("contextManager") || I.includes("setupConfig")) && (c.push(I.trim()), c.length >= t)) break;
|
|
839
|
+
for (const I of c) {
|
|
840
|
+
const d = this.parseStackFrame(I);
|
|
841
|
+
d ? (async () => {
|
|
842
|
+
const { originalPos: C } = await this.getOriginalPosition(d.filePath, d.line, d.column);
|
|
843
|
+
if (C) {
|
|
844
|
+
l().sfDebug && console.log("[RequestInterceptor] First user code line:", C);
|
|
845
|
+
const p = { line: C.line?.toString() || L.UNKNOWN, column: C.column?.toString() || L.NOT_CAPTURED, name: C.name || L.NOT_CAPTURED, entrypoint: C.source, retryWithoutTraceId: i };
|
|
846
|
+
e.doSend(p);
|
|
1441
847
|
}
|
|
1442
|
-
})() :
|
|
848
|
+
})() : l().sfDebug && console.error("Could not parse stack line:", I);
|
|
1443
849
|
}
|
|
1444
850
|
}
|
|
1445
|
-
addReentrancyGuardHeaders(
|
|
1446
|
-
|
|
1447
|
-
}
|
|
1448
|
-
shouldPropagateHeaders(
|
|
1449
|
-
return !
|
|
1450
|
-
}
|
|
1451
|
-
addTracingHeaders(
|
|
1452
|
-
const
|
|
1453
|
-
return
|
|
1454
|
-
}
|
|
1455
|
-
addTracingHeader(
|
|
1456
|
-
const
|
|
1457
|
-
|
|
1458
|
-
}
|
|
1459
|
-
patchFetch(
|
|
1460
|
-
const
|
|
1461
|
-
typeof
|
|
1462
|
-
this.captureFirstUserLines(
|
|
1463
|
-
const
|
|
1464
|
-
let
|
|
1465
|
-
typeof
|
|
1466
|
-
|
|
1467
|
-
})) :
|
|
1468
|
-
const
|
|
1469
|
-
let
|
|
851
|
+
addReentrancyGuardHeaders(e) {
|
|
852
|
+
e.set(this.HEADER_LOG_GUARD, "true"), e.set(this.HEADER_PRINT_GUARD, "true"), e.set(this.HEADER_EXCEPTION_GUARD, "true");
|
|
853
|
+
}
|
|
854
|
+
shouldPropagateHeaders(e) {
|
|
855
|
+
return !Ae.some((t) => new RegExp(`^${t.replace(/\*/g, ".*")}$`).test(e));
|
|
856
|
+
}
|
|
857
|
+
addTracingHeaders(e, t) {
|
|
858
|
+
const i = new URL(t).hostname, n = this.shouldPropagateHeaders(i);
|
|
859
|
+
return n ? this.addTracingHeader(e, t) : l().sfDebug && console.error(`[RequestInterceptor] Excluded domain: ${i}`), n;
|
|
860
|
+
}
|
|
861
|
+
addTracingHeader(e, t) {
|
|
862
|
+
const i = this.contextManager.getOrSetSfTraceId(), n = this.contextManager.getOrSetPageVisitUUID(), o = H();
|
|
863
|
+
e.set(this.HEADER_TRACING, `${i}/${n}/${o}`), l().sfDebug && console.log(`[RequestInterceptor] Added tracing header for ${t}`);
|
|
864
|
+
}
|
|
865
|
+
patchFetch(e, t) {
|
|
866
|
+
const i = globalThis.fetch;
|
|
867
|
+
typeof i == "function" ? globalThis.fetch = async (n, o) => {
|
|
868
|
+
this.captureFirstUserLines(e);
|
|
869
|
+
const a = Date.now(), r = new Headers(o?.headers);
|
|
870
|
+
let g;
|
|
871
|
+
typeof n == "string" || n instanceof URL ? g = n.toString() : n instanceof Request ? (g = n.url, n.headers.forEach((h, A) => {
|
|
872
|
+
r.set(A, h);
|
|
873
|
+
})) : l().sfDebug && console.error("[Sailfish RequestInterceptor] Invalid fetch input."), l().sfDebug && console.log("[RequestInterceptor] Fetching request to:", g);
|
|
874
|
+
const c = new URL(g).hostname, I = new Headers(r), d = this.addTracingHeaders(r, g), C = { ...o, headers: r };
|
|
875
|
+
let p;
|
|
1470
876
|
try {
|
|
1471
|
-
let
|
|
1472
|
-
this.addTracingHeaders(
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1475
|
-
const { sessionId:
|
|
1476
|
-
return
|
|
1477
|
-
} catch (
|
|
1478
|
-
const
|
|
1479
|
-
|
|
877
|
+
let h = !1;
|
|
878
|
+
this.addTracingHeaders(I, g), p = await i(g, C), d && q.includes(p.status) ? (p = await i(g, { ...o, headers: I }), h = !0, this.captureFirstUserLines(e, 10, h)) : this.contextManager.addSupportedDomains(c);
|
|
879
|
+
const A = Date.now();
|
|
880
|
+
l().sfDebug && console.log(`[RequestInterceptor] Fetch completed: ${g}, Status: ${p.status}, Duration: ${A - a}ms`);
|
|
881
|
+
const { sessionId: b, pageVisitId: Z, requestId: f } = this.extractIdsFromTraceHeader(r);
|
|
882
|
+
return t.doSend({ apiKey: l().apiKey, requestId: f, pageVisitId: Z, recordingSessionId: b, serviceUuid: l().serviceUUID, timestampStart: a.toString(), timestampEnd: A.toString(), responseCode: p.status, success: !0, error: null, url: g, method: C.method || "GET", retryWithoutTraceId: h, parentSpanId: P() }), p;
|
|
883
|
+
} catch (h) {
|
|
884
|
+
const A = Date.now();
|
|
885
|
+
l().sfDebug && console.error(`[RequestInterceptor] Fetch failed: ${g}, Error: ${h}, Duration: ${A - a}ms`);
|
|
1480
886
|
}
|
|
1481
|
-
} :
|
|
887
|
+
} : l().sfDebug && console.error("[RequestInterceptor] Fetch not available.");
|
|
1482
888
|
}
|
|
1483
|
-
patchHttp(
|
|
1484
|
-
if (
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1487
|
-
let
|
|
889
|
+
patchHttp(e, t) {
|
|
890
|
+
if (l().sfDebug && console.log("[RequestInterceptor] Initializing HTTP/HTTPS request patch..."), !B || typeof B.request != "function") return void (l().sfDebug && console.log("[RequestInterceptor] HTTP/HTTPS not available."));
|
|
891
|
+
const i = B.request.bind(B), n = B.request.bind(B);
|
|
892
|
+
B.request = function(o, a) {
|
|
893
|
+
let r;
|
|
1488
894
|
try {
|
|
1489
|
-
if (typeof
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1492
|
-
} else
|
|
1493
|
-
if (
|
|
1494
|
-
const
|
|
1495
|
-
this.addTracingHeaders(
|
|
1496
|
-
} else
|
|
1497
|
-
} catch (
|
|
1498
|
-
throw
|
|
895
|
+
if (typeof o == "string") {
|
|
896
|
+
const c = new URL(o);
|
|
897
|
+
r = { protocol: c.protocol || j, hostname: c.hostname, path: c.pathname + c.search, headers: {} };
|
|
898
|
+
} else o instanceof URL ? r = { protocol: o.protocol || j, hostname: o.hostname, path: o.pathname + o.search, headers: {} } : (r = { ...o }, r.protocol || (r.protocol = j));
|
|
899
|
+
if (r.headers) {
|
|
900
|
+
const c = `${r.protocol}//${r.hostname}`;
|
|
901
|
+
this.addTracingHeaders(r.headers, c), this.captureFirstUserLines(e);
|
|
902
|
+
} else l().sfDebug && console.warn("[RequestInterceptor] No headers found in HTTP request options. Skipping header addition.");
|
|
903
|
+
} catch (c) {
|
|
904
|
+
throw l().sfDebug && console.error("[RequestInterceptor] Error while processing HTTP request options:", c), c;
|
|
1499
905
|
}
|
|
1500
|
-
let
|
|
1501
|
-
return
|
|
1502
|
-
const
|
|
1503
|
-
if (
|
|
1504
|
-
|
|
1505
|
-
const
|
|
1506
|
-
delete
|
|
906
|
+
let g = !1;
|
|
907
|
+
return i(r, (c) => {
|
|
908
|
+
const I = `${r.protocol}//${r.hostname}`;
|
|
909
|
+
if (r.headers && this.shouldPropagateHeaders(new URL(I).hostname) && q.includes(c.statusCode || 0)) {
|
|
910
|
+
r.hostname;
|
|
911
|
+
const h = { ...r, headers: { ...r.headers } };
|
|
912
|
+
delete h.headers[this.HEADER_TRACING], i(h, a), g = !0, this.captureFirstUserLines(e, 10, g);
|
|
1507
913
|
}
|
|
1508
|
-
const { sessionId:
|
|
1509
|
-
|
|
914
|
+
const { sessionId: d, pageVisitId: C, requestId: p } = this.extractIdsFromTraceHeader(r.headers);
|
|
915
|
+
t.doSend({ apiKey: l().apiKey, requestId: p, pageVisitId: C, recordingSessionId: d, serviceUuid: l().serviceUUID, timestampStart: Date.now().toString(), timestampEnd: Date.now().toString(), responseCode: c.statusCode || 0, success: !!c.statusCode && c.statusCode < 400, error: null, url: I, method: r.method || "GET", retryWithoutTraceId: g, parentSpanId: P() }), a?.(c);
|
|
1510
916
|
});
|
|
1511
|
-
},
|
|
1512
|
-
let
|
|
917
|
+
}, B.request = function(o, a) {
|
|
918
|
+
let r;
|
|
1513
919
|
try {
|
|
1514
|
-
if (typeof
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
} else
|
|
1518
|
-
if (
|
|
1519
|
-
const
|
|
1520
|
-
this.addTracingHeaders(
|
|
1521
|
-
} else
|
|
1522
|
-
} catch (
|
|
1523
|
-
throw
|
|
920
|
+
if (typeof o == "string") {
|
|
921
|
+
const c = new URL(o);
|
|
922
|
+
r = { protocol: c.protocol || Q, hostname: c.hostname, path: c.pathname + c.search, headers: {} };
|
|
923
|
+
} else o instanceof URL ? r = { protocol: o.protocol || Q, hostname: o.hostname, path: o.pathname + o.search, headers: {} } : (r = { ...o }, r.protocol || (r.protocol = Q));
|
|
924
|
+
if (r.headers) {
|
|
925
|
+
const c = `${r.protocol}//${r.hostname}`;
|
|
926
|
+
this.addTracingHeaders(r.headers, c);
|
|
927
|
+
} else l().sfDebug && console.warn("[RequestInterceptor] No headers found in HTTPS request options. Skipping header addition.");
|
|
928
|
+
} catch (c) {
|
|
929
|
+
throw l().sfDebug && console.error("[RequestInterceptor] Error while processing HTTPS request options:", c), c;
|
|
1524
930
|
}
|
|
1525
|
-
let
|
|
1526
|
-
return
|
|
1527
|
-
const
|
|
1528
|
-
if (
|
|
1529
|
-
const
|
|
1530
|
-
delete
|
|
931
|
+
let g = !1;
|
|
932
|
+
return n(r, (c) => {
|
|
933
|
+
const I = `${r.protocol}//${r.hostname}`;
|
|
934
|
+
if (r.headers && this.shouldPropagateHeaders(new URL(I).hostname) && q.includes(c.statusCode || 0)) {
|
|
935
|
+
const h = { ...r, headers: { ...r.headers } };
|
|
936
|
+
delete h.headers[this.HEADER_TRACING], n(h, a), g = !0, this.captureFirstUserLines(e, 10, g);
|
|
1531
937
|
}
|
|
1532
|
-
const { sessionId:
|
|
1533
|
-
|
|
938
|
+
const { sessionId: d, pageVisitId: C, requestId: p } = this.extractIdsFromTraceHeader(r.headers);
|
|
939
|
+
t.doSend({ apiKey: l().apiKey, requestId: p, pageVisitId: C, recordingSessionId: d, serviceUuid: l().serviceUUID, timestampStart: Date.now().toString(), timestampEnd: Date.now().toString(), responseCode: c.statusCode || 0, success: !!c.statusCode && c.statusCode < 400, error: null, url: I, method: r.method || "GET", retryWithoutTraceId: g, parentSpanId: P() }), a?.(c);
|
|
1534
940
|
});
|
|
1535
|
-
},
|
|
941
|
+
}, l().sfDebug && console.log("✅ HTTP and HTTPS request methods patched globally.");
|
|
1536
942
|
}
|
|
1537
|
-
tryPatch(
|
|
943
|
+
tryPatch(e, t) {
|
|
1538
944
|
try {
|
|
1539
|
-
require.resolve(
|
|
1540
|
-
} catch (
|
|
1541
|
-
console.warn(`[RequestInterceptor] Could not patch ${
|
|
945
|
+
require.resolve(t), e(), console.log(`[RequestInterceptor] Patched ${t}`);
|
|
946
|
+
} catch (i) {
|
|
947
|
+
console.warn(`[RequestInterceptor] Could not patch ${t}: ${i.message}`);
|
|
1542
948
|
}
|
|
1543
949
|
}
|
|
1544
950
|
getExcludedDomains() {
|
|
1545
951
|
return [...this.contextManager.getExcludedDomains()];
|
|
1546
952
|
}
|
|
1547
953
|
}
|
|
1548
|
-
class
|
|
954
|
+
class _e extends ne {
|
|
1549
955
|
constructor() {
|
|
1550
956
|
super(), this.setOperationName("UpdateServiceDetails");
|
|
1551
957
|
}
|
|
@@ -1553,7 +959,7 @@ class pt extends de {
|
|
|
1553
959
|
this.sendAppIdentifier(), this.send();
|
|
1554
960
|
}
|
|
1555
961
|
async send() {
|
|
1556
|
-
const
|
|
962
|
+
const e = `
|
|
1557
963
|
${this.queryType} ${this.operationName}(
|
|
1558
964
|
$apiKey: String!,
|
|
1559
965
|
$serviceUuid: String!,
|
|
@@ -1561,7 +967,7 @@ class pt extends de {
|
|
|
1561
967
|
$serviceIdentifier: String,
|
|
1562
968
|
$serviceVersion: String,
|
|
1563
969
|
$serviceAdditionalMetadata: JSON,
|
|
1564
|
-
|
|
970
|
+
$gitSha: String!,
|
|
1565
971
|
) {
|
|
1566
972
|
${this.queryName}(
|
|
1567
973
|
apiKey: $apiKey,
|
|
@@ -1570,61 +976,266 @@ class pt extends de {
|
|
|
1570
976
|
serviceIdentifier: $serviceIdentifier,
|
|
1571
977
|
serviceVersion: $serviceVersion,
|
|
1572
978
|
serviceAdditionalMetadata: $serviceAdditionalMetadata,
|
|
1573
|
-
|
|
979
|
+
gitSha: $gitSha,
|
|
1574
980
|
)
|
|
1575
981
|
}
|
|
1576
|
-
`,
|
|
1577
|
-
|
|
982
|
+
`, t = this.getVariables({ serviceIdentifier: l().serviceIdentifier, serviceVersion: l().serviceVersion, serviceAdditionalMetadata: l().serviceAdditionalMetadata, gitSha: l().gitSha || "" });
|
|
983
|
+
F(this.endpoint, this.operationName, e, t);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
function Ee() {
|
|
987
|
+
return { capture_arguments: w(process.env.SF_FUNCSPAN_CAPTURE_ARGUMENTS, !0), capture_return_value: w(process.env.SF_FUNCSPAN_CAPTURE_RETURN_VALUE, !0), arg_limit_mb: parseInt(process.env.SF_FUNCSPAN_ARG_LIMIT_MB || "1", 10), return_limit_mb: parseInt(process.env.SF_FUNCSPAN_RETURN_LIMIT_MB || "1", 10), autocapture_all_child_functions: w(process.env.SF_FUNCSPAN_AUTOCAPTURE_ALL_CHILD_FUNCTIONS, !1), sample_rate: parseFloat(process.env.SF_FUNCSPAN_SAMPLE_RATE || "1.0"), enable_sampling: w(process.env.SF_FUNCSPAN_ENABLE_SAMPLING, !1), capture_sf_veritas: w(process.env.SF_FUNCSPAN_CAPTURE_SF_VERITAS, !1), parse_json_strings: w(process.env.SF_FUNCSPAN_PARSE_JSON_STRINGS, !1) };
|
|
988
|
+
}
|
|
989
|
+
function et() {
|
|
990
|
+
return { capture_arguments: !1, capture_return_value: !1, arg_limit_mb: 1, return_limit_mb: 1, autocapture_all_child_functions: !1, sample_rate: 0, enable_sampling: !1, capture_sf_veritas: !1, parse_json_strings: !1 };
|
|
991
|
+
}
|
|
992
|
+
function De(s) {
|
|
993
|
+
try {
|
|
994
|
+
const e = s.split("-");
|
|
995
|
+
return e.length !== 9 ? (console.error(`[FuncSpan] Invalid header format: expected 9 parts, got ${e.length}`), null) : { capture_arguments: e[0] === "1", capture_return_value: e[1] === "1", arg_limit_mb: parseInt(e[2], 10), return_limit_mb: parseInt(e[3], 10), autocapture_all_child_functions: e[4] === "1", sample_rate: parseFloat(e[5]), enable_sampling: e[6] === "1", capture_sf_veritas: e[7] === "1", parse_json_strings: e[8] === "1" };
|
|
996
|
+
} catch (e) {
|
|
997
|
+
return console.error(`[FuncSpan] Failed to parse header override "${s}":`, e), null;
|
|
1578
998
|
}
|
|
1579
999
|
}
|
|
1580
|
-
function
|
|
1581
|
-
if (!
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1000
|
+
function w(s, e) {
|
|
1001
|
+
if (!s) return e;
|
|
1002
|
+
const t = s.toLowerCase();
|
|
1003
|
+
return t === "true" || t === "1" || t === "yes";
|
|
1004
|
+
}
|
|
1005
|
+
const ie = new te();
|
|
1006
|
+
function tt(s) {
|
|
1007
|
+
ie.enterWith(s);
|
|
1008
|
+
}
|
|
1009
|
+
function Le() {
|
|
1010
|
+
return ie.getStore();
|
|
1011
|
+
}
|
|
1012
|
+
function nt() {
|
|
1013
|
+
ie.enterWith(void 0);
|
|
1014
|
+
}
|
|
1015
|
+
function E(...s) {
|
|
1016
|
+
const e = {};
|
|
1017
|
+
for (const t of s) for (const i in t) t[i] !== void 0 && (e[i] = t[i]);
|
|
1018
|
+
return e;
|
|
1019
|
+
}
|
|
1020
|
+
function ee(s, e) {
|
|
1021
|
+
try {
|
|
1022
|
+
const t = JSON.stringify(s).length / 1048576;
|
|
1023
|
+
return t <= e ? s : { _truncated: !0, _originalSizeMB: t.toFixed(2), _limitMB: e, _preview: JSON.stringify(s).substring(0, 500) + "..." };
|
|
1024
|
+
} catch {
|
|
1025
|
+
return { _error: "Failed to serialize data", _type: typeof s };
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
class ze {
|
|
1029
|
+
constructor(e = [process.cwd()], t = !1) {
|
|
1030
|
+
u(this, "rootPaths");
|
|
1031
|
+
u(this, "fileConfigs", /* @__PURE__ */ new Map());
|
|
1032
|
+
u(this, "functionConfigs", /* @__PURE__ */ new Map());
|
|
1033
|
+
u(this, "directoryConfigs", /* @__PURE__ */ new Map());
|
|
1034
|
+
u(this, "hasSailfishFiles", !1);
|
|
1035
|
+
u(this, "debug");
|
|
1036
|
+
this.rootPaths = e, this.debug = t || process.env.SF_DEBUG === "true";
|
|
1037
|
+
}
|
|
1038
|
+
async loadAllConfigs() {
|
|
1039
|
+
this.debug && console.log("[FuncSpan ConfigLoader] Scanning for .sailfish files in:", this.rootPaths);
|
|
1040
|
+
const e = [];
|
|
1041
|
+
for (const t of this.rootPaths) $.existsSync(t) ? await this._walkDirectory(t, e) : this.debug && console.log(`[FuncSpan ConfigLoader] Root path does not exist: ${t}`);
|
|
1042
|
+
e.length > 0 ? (this.hasSailfishFiles = !0, this.debug && (console.log(`[FuncSpan ConfigLoader] Found ${e.length} .sailfish files:`), e.forEach((t) => console.log(`[FuncSpan ConfigLoader] - ${t}`)))) : this.debug && console.log("[FuncSpan ConfigLoader] No .sailfish files found - function spans disabled by default");
|
|
1043
|
+
for (const t of e) await this._loadConfigFile(t);
|
|
1044
|
+
await this._resolveInheritance(), this.debug && console.log(`[FuncSpan ConfigLoader] Loaded ${this.fileConfigs.size} file configs, ${this.functionConfigs.size} function configs`);
|
|
1045
|
+
}
|
|
1046
|
+
getConfig(e, t) {
|
|
1047
|
+
const i = this.hasSailfishFiles ? Ee() : { capture_arguments: !1, capture_return_value: !1, arg_limit_mb: 1, return_limit_mb: 1, autocapture_all_child_functions: !1, sample_rate: 0, enable_sampling: !1, capture_sf_veritas: !1, parse_json_strings: !1 }, n = this._getDirectoryConfig(e), o = v.normalize(e), a = this.fileConfigs.get(o) || {};
|
|
1048
|
+
let r = {};
|
|
1049
|
+
if (t) {
|
|
1050
|
+
const g = this.functionConfigs.get(o);
|
|
1051
|
+
g && (r = g.get(t) || {});
|
|
1594
1052
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1053
|
+
return E(i, n, a, r);
|
|
1054
|
+
}
|
|
1055
|
+
async _walkDirectory(e, t) {
|
|
1056
|
+
try {
|
|
1057
|
+
const i = $.readdirSync(e, { withFileTypes: !0 });
|
|
1058
|
+
for (const n of i) {
|
|
1059
|
+
const o = v.join(e, n.name);
|
|
1060
|
+
n.name === "node_modules" || n.name === ".git" || n.name.startsWith(".") || (n.isDirectory() ? await this._walkDirectory(o, t) : n.name === ".sailfish" && t.push(o));
|
|
1061
|
+
}
|
|
1062
|
+
} catch (i) {
|
|
1063
|
+
this.debug && console.error(`[FuncSpan ConfigLoader] Error walking directory ${e}:`, i);
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
async _loadConfigFile(e) {
|
|
1067
|
+
try {
|
|
1068
|
+
const t = $.readFileSync(e, "utf-8"), i = v.dirname(e);
|
|
1069
|
+
let n = null;
|
|
1070
|
+
try {
|
|
1071
|
+
n = JSON.parse(t);
|
|
1072
|
+
} catch {
|
|
1073
|
+
try {
|
|
1074
|
+
n = require("js-yaml").load(t);
|
|
1075
|
+
} catch (o) {
|
|
1076
|
+
return void (this.debug && console.error(`[FuncSpan ConfigLoader] Failed to parse ${e} as JSON or YAML:`, o));
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
if (!n) return;
|
|
1080
|
+
n.default && this.directoryConfigs.set(i, n.default), n.files && await this._expandFileGlobs(i, n.files, n.default || {}), n.functions && this._storeFunctionConfigs(i, n.functions, n.default || {}), this.debug && (console.log(`[FuncSpan ConfigLoader] Loaded config from ${e}`), console.log(`[FuncSpan ConfigLoader] Directory: ${i}`), console.log(`[FuncSpan ConfigLoader] Has default: ${!!n.default}`), console.log(`[FuncSpan ConfigLoader] File patterns: ${Object.keys(n.files || {}).length}`), console.log(`[FuncSpan ConfigLoader] Functions: ${Object.keys(n.functions || {}).length}`));
|
|
1081
|
+
} catch (t) {
|
|
1082
|
+
this.debug && console.error(`[FuncSpan ConfigLoader] Error loading ${e}:`, t);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
async _expandFileGlobs(e, t, i) {
|
|
1086
|
+
for (const [n, o] of Object.entries(t)) try {
|
|
1087
|
+
const a = v.join(e, n), r = await Ze(a, { absolute: !0, nodir: !0, ignore: ["**/node_modules/**", "**/.git/**"] });
|
|
1088
|
+
this.debug && console.log(`[FuncSpan ConfigLoader] Pattern '${n}' matched ${r.length} files`);
|
|
1089
|
+
for (const g of r) {
|
|
1090
|
+
const c = v.normalize(g), I = E(i, o);
|
|
1091
|
+
this.fileConfigs.set(c, I), this.debug && r.length <= 5 && console.log(`[FuncSpan ConfigLoader] - ${g}`);
|
|
1092
|
+
}
|
|
1093
|
+
} catch (a) {
|
|
1094
|
+
this.debug && console.error(`[FuncSpan ConfigLoader] Error expanding glob '${n}':`, a);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
_storeFunctionConfigs(e, t, i) {
|
|
1098
|
+
for (const [n, o] of Object.entries(t)) {
|
|
1099
|
+
const a = n.split("::");
|
|
1100
|
+
if (a.length !== 2) {
|
|
1101
|
+
this.debug && console.warn(`[FuncSpan ConfigLoader] Invalid function pattern '${n}' (expected format: 'file.ts::functionName')`);
|
|
1102
|
+
continue;
|
|
1103
|
+
}
|
|
1104
|
+
const [r, g] = a, c = v.normalize(v.join(e, r));
|
|
1105
|
+
this.functionConfigs.has(c) || this.functionConfigs.set(c, /* @__PURE__ */ new Map());
|
|
1106
|
+
const I = this.functionConfigs.get(c), d = E(i, o);
|
|
1107
|
+
I.set(g, d), this.debug && console.log(`[FuncSpan ConfigLoader] Function config: ${c}::${g}`);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
async _resolveInheritance() {
|
|
1111
|
+
}
|
|
1112
|
+
_getDirectoryConfig(e) {
|
|
1113
|
+
let t = v.dirname(v.normalize(e));
|
|
1114
|
+
const i = [];
|
|
1115
|
+
for (; t && t !== v.dirname(t); ) {
|
|
1116
|
+
const n = this.directoryConfigs.get(t);
|
|
1117
|
+
n && i.unshift(n), t = v.dirname(t);
|
|
1118
|
+
}
|
|
1119
|
+
return i.reduce((n, o) => E(n, o), {});
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
let J = null;
|
|
1123
|
+
async function xe(s, e) {
|
|
1124
|
+
J = new ze(s, e), await J.loadAllConfigs();
|
|
1125
|
+
}
|
|
1126
|
+
function $e(s, e) {
|
|
1127
|
+
return J ? J.getConfig(s, e) : { capture_arguments: !1, capture_return_value: !1, arg_limit_mb: 1, return_limit_mb: 1, autocapture_all_child_functions: !1, sample_rate: 0, enable_sampling: !1, capture_sf_veritas: !1, parse_json_strings: !1 };
|
|
1128
|
+
}
|
|
1129
|
+
function ke() {
|
|
1130
|
+
return J !== null;
|
|
1131
|
+
}
|
|
1132
|
+
function it(s) {
|
|
1133
|
+
if (!s || !s.apiKey) {
|
|
1134
|
+
const n = `The required API Key is not provided: ${JSON.stringify(s)}`;
|
|
1135
|
+
console.error(n);
|
|
1136
|
+
}
|
|
1137
|
+
const { config: e } = Be(s);
|
|
1138
|
+
if (e.sfDebug && console.log("Updated configuration after applying options:", e), !e.apiKey || !e.apiGraphqlEndpoint) {
|
|
1139
|
+
const n = `The required config is not provided: ${JSON.stringify(e)}`;
|
|
1140
|
+
throw console.error(n), new Error(n);
|
|
1141
|
+
}
|
|
1142
|
+
ke() || xe(void 0, e.sfDebug).catch((n) => {
|
|
1143
|
+
e.sfDebug && console.error("[FuncSpan] Failed to initialize config loader:", n);
|
|
1144
|
+
});
|
|
1145
|
+
const t = new ne();
|
|
1146
|
+
t.setServiceUUID(e.serviceUUID), (function(n) {
|
|
1147
|
+
function o(d, C) {
|
|
1148
|
+
n.setOperationName("CollectLogs"), n.doSend([C, d]);
|
|
1149
|
+
}
|
|
1150
|
+
const a = console.log.bind(console), r = console.error.bind(console), g = console.warn.bind(console), c = console.info.bind(console), I = console.debug.bind(console);
|
|
1151
|
+
console.log = (...d) => {
|
|
1152
|
+
o("INFO", d.join(" ")), a(...d);
|
|
1153
|
+
}, console.error = (...d) => {
|
|
1154
|
+
o("ERROR", d.join(" ")), r(...d);
|
|
1155
|
+
}, console.warn = (...d) => {
|
|
1156
|
+
o("WARN", d.join(" ")), g(...d);
|
|
1157
|
+
}, console.info = (...d) => {
|
|
1158
|
+
o("INFO", d.join(" ")), c(...d);
|
|
1159
|
+
}, l().logLevel === "DEBUG" && (console.debug = (...d) => {
|
|
1160
|
+
o("DEBUG", d.join(" ")), I(...d);
|
|
1606
1161
|
});
|
|
1607
|
-
})(
|
|
1608
|
-
const
|
|
1609
|
-
new
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1612
|
-
})(
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1162
|
+
})(t), (function(n = []) {
|
|
1163
|
+
const o = new Te(n);
|
|
1164
|
+
new Ue().doSend(o.getExcludedDomains());
|
|
1165
|
+
const a = new Xe(), r = new Je();
|
|
1166
|
+
o.patchFetch(a, r), o.patchHttp(a, r);
|
|
1167
|
+
})(e.domainsToNotPropagateHeadersTo);
|
|
1168
|
+
const i = new Ye();
|
|
1169
|
+
i.setServiceUUID(e.serviceUUID), we(i), Ke(), new _e().send();
|
|
1615
1170
|
}
|
|
1616
|
-
function
|
|
1617
|
-
const
|
|
1618
|
-
new
|
|
1171
|
+
function ot(s, e, t, i = !1) {
|
|
1172
|
+
const n = l();
|
|
1173
|
+
new me(n.apiKey).identify(s, e, t, i);
|
|
1619
1174
|
}
|
|
1620
|
-
function
|
|
1621
|
-
const
|
|
1622
|
-
new
|
|
1175
|
+
function st(s, e = {}, t, i = !1) {
|
|
1176
|
+
const n = l();
|
|
1177
|
+
new me(n.apiKey).addOrUpdateMetadata(s, e, t, i);
|
|
1178
|
+
}
|
|
1179
|
+
function rt(s, e, t, i) {
|
|
1180
|
+
const n = function(...o) {
|
|
1181
|
+
const a = (function(C, p) {
|
|
1182
|
+
const h = Le();
|
|
1183
|
+
if (h) {
|
|
1184
|
+
const A = De(h);
|
|
1185
|
+
if (A) return process.env.SF_DEBUG === "true" && console.log(`[FuncSpan] Using HTTP header override for ${C}::${p}`), A;
|
|
1186
|
+
}
|
|
1187
|
+
return $e(C, p);
|
|
1188
|
+
})(t, e);
|
|
1189
|
+
if (a.enable_sampling && a.sample_rate < 1 && Math.random() > a.sample_rate) return s.apply(this, o);
|
|
1190
|
+
if (a.sample_rate === 0) return s.apply(this, o);
|
|
1191
|
+
const r = G.getInstance(), g = r.getCurrentFunctionSpanId(), c = H();
|
|
1192
|
+
r.setCurrentFunctionSpanId(c);
|
|
1193
|
+
const I = Date.now();
|
|
1194
|
+
let d = null;
|
|
1195
|
+
a.capture_arguments && (d = {}, i.paramNames.forEach((C, p) => {
|
|
1196
|
+
p < o.length && (d[C] = o[p]);
|
|
1197
|
+
}), d && a.arg_limit_mb > 0 && (d = ee(d, a.arg_limit_mb)));
|
|
1198
|
+
try {
|
|
1199
|
+
const C = s.apply(this, o);
|
|
1200
|
+
if (C && typeof C.then == "function") return C.then((A) => {
|
|
1201
|
+
const b = Date.now();
|
|
1202
|
+
let Z = null;
|
|
1203
|
+
return a.capture_return_value && a.return_limit_mb > 0 && (Z = ee(A, a.return_limit_mb)), D({ functionName: e, filePath: t, metadata: i, args: d, result: Z, error: null, duration: b - I, async: !0, spanId: c }), g ? r.setCurrentFunctionSpanId(g) : r.clearCurrentFunctionSpanId(), A;
|
|
1204
|
+
}, (A) => {
|
|
1205
|
+
const b = Date.now();
|
|
1206
|
+
throw D({ functionName: e, filePath: t, metadata: i, args: d, result: null, error: A?.message || String(A), duration: b - I, async: !0, spanId: c }), g ? r.setCurrentFunctionSpanId(g) : r.clearCurrentFunctionSpanId(), A;
|
|
1207
|
+
});
|
|
1208
|
+
const p = Date.now();
|
|
1209
|
+
let h = null;
|
|
1210
|
+
return a.capture_return_value && a.return_limit_mb > 0 && (h = ee(C, a.return_limit_mb)), D({ functionName: e, filePath: t, metadata: i, args: d, result: h, error: null, duration: p - I, async: !1, spanId: c }), g ? r.setCurrentFunctionSpanId(g) : r.clearCurrentFunctionSpanId(), C;
|
|
1211
|
+
} catch (C) {
|
|
1212
|
+
const p = Date.now();
|
|
1213
|
+
throw D({ functionName: e, filePath: t, error: C?.message || String(C), duration: p - I, async: !1 }), g ? r.setCurrentFunctionSpanId(g) : r.clearCurrentFunctionSpanId(), C;
|
|
1214
|
+
}
|
|
1215
|
+
};
|
|
1216
|
+
Object.defineProperty(n, "name", { value: e, writable: !1 });
|
|
1217
|
+
for (const o in s) s.hasOwnProperty(o) && (n[o] = s[o]);
|
|
1218
|
+
return n;
|
|
1219
|
+
}
|
|
1220
|
+
function D(s) {
|
|
1221
|
+
process.env.SF_VERITAS_DEBUG === "true" && console.log("[FuncSpan Capture]", { function: s.functionName, file: s.filePath, duration: `${s.duration}ms`, async: s.async, error: s.error }), Ne(() => {
|
|
1222
|
+
});
|
|
1623
1223
|
}
|
|
1624
1224
|
export {
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1225
|
+
G as ContextManager,
|
|
1226
|
+
st as addOrUpdateMetadata,
|
|
1227
|
+
rt as captureFunctionSpan,
|
|
1228
|
+
nt as clearFuncspanOverride,
|
|
1229
|
+
P as getCurrentFunctionSpanId,
|
|
1230
|
+
et as getDefaultConfig,
|
|
1231
|
+
Ee as getEnvConfig,
|
|
1232
|
+
Le as getFuncspanOverride,
|
|
1233
|
+
$e as getGlobalConfig,
|
|
1234
|
+
ot as identify,
|
|
1235
|
+
xe as initializeConfigLoader,
|
|
1236
|
+
ke as isConfigLoaderInitialized,
|
|
1237
|
+
De as parseHeaderOverride,
|
|
1238
|
+
Ne as runWithContext,
|
|
1239
|
+
tt as setFuncspanOverride,
|
|
1240
|
+
it as setupInterceptors
|
|
1630
1241
|
};
|