@sailfish-ai/sf-veritas 0.2.18 → 0.2.20

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/README.md CHANGED
@@ -225,6 +225,7 @@ type Identify = (
225
225
 
226
226
  #### Identify Example
227
227
 
228
+
228
229
  In order to identify, you will need to call the `identify` method. You can also force an override of stored values by setting the `override` argument to `true`.
229
230
 
230
231
  ```ts title="Link a user to a recording"
@@ -0,0 +1 @@
1
+ "use strict";const A=require("async_hooks"),U=require("child_process"),h=require("fs"),P=require("fs/promises"),m=require("os");function D(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const M=D(P),R=D(m),o=[];for(let s=0;s<256;++s)o.push((s+256).toString(16).slice(1));let C;const b=new Uint8Array(16),O={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function g(s,e,t){if(O.randomUUID&&!s)return O.randomUUID();const r=(s=s||{}).random??s.rng?.()??(function(){if(!C){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");C=crypto.getRandomValues.bind(crypto)}return C(b)})();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(function(n,i=0){return(o[n[i+0]]+o[n[i+1]]+o[n[i+2]]+o[n[i+3]]+"-"+o[n[i+4]]+o[n[i+5]]+"-"+o[n[i+6]]+o[n[i+7]]+"-"+o[n[i+8]]+o[n[i+9]]+"-"+o[n[i+10]]+o[n[i+11]]+o[n[i+12]]+o[n[i+13]]+o[n[i+14]]+o[n[i+15]]).toLowerCase()})(r)}class x{apiKey;apiGraphqlEndpoint;sfDebug;serviceIdentifier;serviceVersion;serviceUUID;serviceAdditionalMetadata;profilingModeEnabled;profilingMaxDepth;profilingMaxVariableSizeKb;domainsToNotPropagateHeadersTo;nodeModulesToCollectLocalVariablesOn;printConfigurationStatuses;logLevel;stackDepthLocals;stackDepthCodeTraceDepth;packageLibraryType;version;gitSha;gitOrg;gitRepo;gitProvider;serviceDisplayName;infrastructureType;infrastructureDetails;setupInterceptorsFile;setupInterceptorsLine;logIgnoreRegex;captureRequestHeaders;captureResponseHeaders;captureRequestBody;captureResponseBody;requestBodyLimitBytes;responseBodyLimitBytes;_serviceIdentificationReceived=!1;constructor(e){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=g(),this.serviceVersion=e?.serviceVersion||process.env.SERVICE_VERSION,this.gitSha=e?.gitSha||process.env.GIT_SHA||process.env.GITHUB_SHA||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT||process.env.VERCEL_GIT_COMMIT_SHA||process.env.CIRCLE_SHA1||process.env.HEROKU_SLUG_COMMIT||process.env.RENDER_GIT_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION;const t=process.env.GITHUB_REPOSITORY?.split("/");this.gitOrg=e?.gitOrg||process.env.GIT_ORG||(t&&t.length>=2?t[0]:void 0)||process.env.CI_PROJECT_NAMESPACE||process.env.BITBUCKET_REPO_OWNER||process.env.VERCEL_GIT_REPO_OWNER||process.env.CIRCLE_PROJECT_USERNAME,this.gitRepo=e?.gitRepo||process.env.GIT_REPO||(t&&t.length>=2?t.slice(1).join("/"):void 0)||process.env.CI_PROJECT_NAME||process.env.BITBUCKET_REPO_SLUG||process.env.VERCEL_GIT_REPO_SLUG||process.env.CIRCLE_PROJECT_REPONAME,this.gitProvider=e?.gitProvider||process.env.GIT_PROVIDER||(process.env.GITHUB_ACTIONS?"github":void 0)||(process.env.GITLAB_CI?"gitlab":void 0)||(process.env.BITBUCKET_PIPELINE_UUID?"bitbucket":void 0)||(process.env.CIRCLECI?"circleci":void 0),this.serviceDisplayName=e?.serviceDisplayName||process.env.SERVICE_DISPLAY_NAME,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();const r=(function(){return process.env.KUBERNETES_SERVICE_HOST||h.existsSync("/var/run/secrets/kubernetes.io/serviceaccount/token")?{type:"Kubernetes",details:{namespace:process.env.POD_NAMESPACE||"",podName:process.env.HOSTNAME||"",nodeName:process.env.NODE_NAME||""}}:process.env.AWS_LAMBDA_FUNCTION_NAME?{type:"AWS Lambda",details:{functionName:process.env.AWS_LAMBDA_FUNCTION_NAME||"",region:process.env.AWS_REGION||"",runtime:process.env.AWS_EXECUTION_ENV||""}}:process.env.AWS_EXECUTION_ENV?{type:"AWS",details:{executionEnv:process.env.AWS_EXECUTION_ENV||"",region:process.env.AWS_REGION||""}}:process.env.GOOGLE_CLOUD_PROJECT?{type:"Google Cloud",details:{project:process.env.GOOGLE_CLOUD_PROJECT||""}}:process.env.AZURE_FUNCTIONS_ENVIRONMENT?{type:"Azure Functions",details:{environment:process.env.AZURE_FUNCTIONS_ENVIRONMENT||""}}:process.env.VERCEL?{type:"Vercel",details:{env:process.env.VERCEL_ENV||"",region:process.env.VERCEL_REGION||""}}:process.env.NETLIFY?{type:"Netlify",details:{}}:process.env.FLY_APP_NAME?{type:"Fly.io",details:{appName:process.env.FLY_APP_NAME||"",region:process.env.FLY_REGION||""}}:process.env.RENDER_SERVICE_ID?{type:"Render",details:{serviceId:process.env.RENDER_SERVICE_ID||""}}:process.env.RAILWAY_ENVIRONMENT?{type:"Railway",details:{environment:process.env.RAILWAY_ENVIRONMENT||""}}:h.existsSync("/.dockerenv")?{type:"Docker",details:{}}:{type:"Unknown",details:{os:R.platform(),arch:R.arch(),nodeVersion:process.version}}})();this.infrastructureType=r.type,this.infrastructureDetails=r.details;const n=process.env.SF_LOG_IGNORE_REGEX;if(n)try{this.logIgnoreRegex=new RegExp(n)}catch{}this.captureRequestHeaders=process.env.SF_NETWORKHOP_CAPTURE_REQUEST_HEADERS==="true",this.captureResponseHeaders=process.env.SF_NETWORKHOP_CAPTURE_RESPONSE_HEADERS==="true",this.captureRequestBody=process.env.SF_NETWORKHOP_CAPTURE_REQUEST_BODY==="true",this.captureResponseBody=process.env.SF_NETWORKHOP_CAPTURE_RESPONSE_BODY==="true";const i=parseInt(process.env.SF_NETWORKHOP_REQUEST_LIMIT_MB||"1",10);this.requestBodyLimitBytes=1024*(isNaN(i)?1:i)*1024;const c=parseInt(process.env.SF_NETWORKHOP_RESPONSE_LIMIT_MB||"1",10);this.responseBodyLimitBytes=1024*(isNaN(c)?1:c)*1024}getPackageVersion(){return"0.2.14"}get serviceIdentificationReceived(){return this._serviceIdentificationReceived}setServiceIdentificationReceived(e){this._serviceIdentificationReceived=e}}const L=Symbol.for("sailfish.sf_config");function S(){return globalThis[L]}function _(){const s=S();if(!s)throw new Error("Configuration has not been initialized. Call getOrCreateConfig(options) first.");return s}const T=Symbol.for("sf.ctx.storeAls"),a=globalThis,v=a[T]??(a[T]=new A.AsyncLocalStorage),y=["identitytoolkit.googleapis.com","t.co","*.twitter.com","*.gravatar.com","*.googleapis.com","*.amazonaws.com","*.smooch.io","*.zendesk.com"],f=Symbol.for("sf.ctx.als"),E=a[f]??(a[f]=new A.AsyncLocalStorage),N=Symbol.for("sf.ctx.sessionRegistry"),d=a[N]??(a[N]=new Map),l={handledExceptions:new Set,reentrancyGuardLoggingActive:!1,reentrancyGuardLoggingPreActive:!1,reentrancyGuardPrintActive:!1,reentrancyGuardPrintPreActive:!1,reentrancyGuardExceptionActive:!1,reentrancyGuardExceptionPreActive:!1,excludedDomains:new Set(y),supportedDomains:new Set};class p{static GLOBAL_MANAGER_SYMBOL=Symbol.for("sf.ctx.manager");constructor(){}current(){return v.getStore()}ensureStore(){const e=this.current();if(e)return e;const t=new Map;return v.enterWith(t),t}runWith(e,t){const r=this.current()??new Map,n=new Map(r);for(const[i,c]of Object.entries(e))n.set(i,c);return v.run(n,t)}static getInstance(){return a[p.GLOBAL_MANAGER_SYMBOL]||(a[p.GLOBAL_MANAGER_SYMBOL]=new p),a[p.GLOBAL_MANAGER_SYMBOL]}getCurrentContext(){return E.getStore()||l}setCurrentContext(e){const t=E.getStore()||l;E.enterWith({...t,...e})}ensureSession(e){let t=d.get(e);return t||(t={...l},d.set(e,t)),t}getContextFor(e){return d.get(e)??l}updateContextFor(e,t){const r=this.ensureSession(e);d.set(e,{...r,...t})}runWithSession(e,t){const r={...this.ensureSession(e)};return E.run(r,t)}deleteSession(e){d.delete(e)}getTraceId(){return this.getCurrentContext().traceId}getPageVisitUUID(){return this.getCurrentContext().pageVisitUUID}setTraceId(e){this.setCurrentContext({traceId:e})}setPageVisitUUID(e){this.setCurrentContext({pageVisitUUID:e})}getCurrentFunctionSpanId(){return this.getCurrentContext().currentFunctionSpanId}setCurrentFunctionSpanId(e){this.setCurrentContext({currentFunctionSpanId:e})}clearCurrentFunctionSpanId(){this.setCurrentContext({currentFunctionSpanId:void 0})}getOrSetSfTraceId(e,t=!1){let r=this.getTraceId();return r||(r=e||(t?g():`nonsession-applogs-v3/${_().apiKey}/${g()}`),this.setTraceId(r),_().sfDebug&&console.log(" Created new trace ID:",r),r)}getOrSetPageVisitUUID(){let e=this.getPageVisitUUID();return e||(e=g(),this.setPageVisitUUID(e),_().sfDebug&&console.log(" Created new page visit UUID:",e),e)}getHandledExceptions(){return this.getCurrentContext().handledExceptions}markExceptionHandled(e){const t=this.getHandledExceptions();t.add(e),this.setCurrentContext({handledExceptions:t})}hasHandledException(e){return this.getHandledExceptions().has(e)}resetHandledExceptions(){this.setCurrentContext({handledExceptions:new Set})}getExcludedDomains(){return this.getCurrentContext().excludedDomains}getSupportedDomains(){return this.getCurrentContext().supportedDomains}addSupportedDomains(e){this.getCurrentContext().supportedDomains.add(e.toLowerCase().trim())}setTraceIdFor(e,t){this.updateContextFor(e,{traceId:t})}setPageVisitUUIDFor(e,t){this.updateContextFor(e,{pageVisitUUID:t})}}exports.ContextManager=p,exports.DEFAULT_DOMAINS_TO_EXCLUDE=y,exports.backfillGitInfoAsync=async function(s){if(!(s.gitOrg&&s.gitRepo&&s.gitProvider))try{const e=await(async function(){let t="";try{t=await new Promise((r,n)=>{U.execFile("git",["remote","get-url","origin"],{timeout:3e3},(i,c)=>{i?n(i):r((c||"").trim())})})}catch{try{const r=(await M.readFile(".git/config","utf-8")).match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);r&&(t=r[1].trim())}catch{}}return t?(function(r){let n,i,c;if(r.includes("github.com")?n="github":r.includes("gitlab.com")?n="gitlab":r.includes("bitbucket.org")&&(n="bitbucket"),r.startsWith("https://")||r.startsWith("http://")){const u=r.split("/");u.length>=5&&(i=u[3],c=u[4].replace(/\.git$/,""))}else{const u=r.indexOf(":");if(u>0){const I=r.substring(u+1).replace(/\.git$/,"").split("/");I.length>=2&&(i=I[0],c=I[1])}}return{org:i,repo:c,provider:n}})(t):{}})();s.gitOrg||(s.gitOrg=e.org),s.gitRepo||(s.gitRepo=e.repo),s.gitProvider||(s.gitProvider=e.provider)}catch{}},exports.getConfig=_,exports.getCurrentFunctionSpanId=function(){return p.getInstance().getCurrentFunctionSpanId()},exports.getGlobalConfigUnsafe=S,exports.getOrCreateConfig=function(s){const e=S();if(e)return{config:e};const t=new x(s);return(function(r){globalThis[L]=r})(t),t.sfDebug&&console.log("[[getOrCreateConfig]] Created global config:",t),{config:t}},exports.runWithContext=function(s){const e={...p.getInstance().getCurrentContext()};E.run(e,()=>{s()})},exports.v4=g;
@@ -1,30 +1,30 @@
1
- var L = Object.defineProperty;
2
- var P = (n, e, t) => e in n ? L(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var s = (n, e, t) => P(n, typeof e != "symbol" ? e + "" : e, t);
1
+ var y = Object.defineProperty;
2
+ var U = (n, e, t) => e in n ? y(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var s = (n, e, t) => U(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { AsyncLocalStorage as D } from "async_hooks";
5
- import { execFile as U } from "child_process";
6
- import { existsSync as f } from "fs";
7
- import * as x from "fs/promises";
8
- import * as R from "os";
9
- const a = [];
10
- for (let n = 0; n < 256; ++n) a.push((n + 256).toString(16).slice(1));
11
- let S;
12
- const b = new Uint8Array(16), N = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
13
- function h(n, e, t) {
14
- if (N.randomUUID && !n) return N.randomUUID();
5
+ import { execFile as P } from "child_process";
6
+ import { existsSync as R } from "fs";
7
+ import * as M from "fs/promises";
8
+ import * as T from "os";
9
+ const c = [];
10
+ for (let n = 0; n < 256; ++n) c.push((n + 256).toString(16).slice(1));
11
+ let v;
12
+ const b = new Uint8Array(16), O = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
13
+ function I(n, e, t) {
14
+ if (O.randomUUID && !n) return O.randomUUID();
15
15
  const r = (n = n || {}).random ?? n.rng?.() ?? (function() {
16
- if (!S) {
16
+ if (!v) {
17
17
  if (typeof crypto > "u" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
18
- S = crypto.getRandomValues.bind(crypto);
18
+ v = crypto.getRandomValues.bind(crypto);
19
19
  }
20
- return S(b);
20
+ return v(b);
21
21
  })();
22
22
  if (r.length < 16) throw new Error("Random bytes length must be >= 16");
23
23
  return r[6] = 15 & r[6] | 64, r[8] = 63 & r[8] | 128, (function(i, o = 0) {
24
- return (a[i[o + 0]] + a[i[o + 1]] + a[i[o + 2]] + a[i[o + 3]] + "-" + a[i[o + 4]] + a[i[o + 5]] + "-" + a[i[o + 6]] + a[i[o + 7]] + "-" + a[i[o + 8]] + a[i[o + 9]] + "-" + a[i[o + 10]] + a[i[o + 11]] + a[i[o + 12]] + a[i[o + 13]] + a[i[o + 14]] + a[i[o + 15]]).toLowerCase();
24
+ return (c[i[o + 0]] + c[i[o + 1]] + c[i[o + 2]] + c[i[o + 3]] + "-" + c[i[o + 4]] + c[i[o + 5]] + "-" + c[i[o + 6]] + c[i[o + 7]] + "-" + c[i[o + 8]] + c[i[o + 9]] + "-" + c[i[o + 10]] + c[i[o + 11]] + c[i[o + 12]] + c[i[o + 13]] + c[i[o + 14]] + c[i[o + 15]]).toLowerCase();
25
25
  })(r);
26
26
  }
27
- class V {
27
+ class x {
28
28
  constructor(e) {
29
29
  s(this, "apiKey");
30
30
  s(this, "apiGraphqlEndpoint");
@@ -61,21 +61,23 @@ class V {
61
61
  s(this, "requestBodyLimitBytes");
62
62
  s(this, "responseBodyLimitBytes");
63
63
  s(this, "_serviceIdentificationReceived", !1);
64
- 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.gitOrg = e?.gitOrg || process.env.GIT_ORG || process.env.VERCEL_GIT_REPO_OWNER, this.gitRepo = e?.gitRepo || process.env.GIT_REPO || process.env.VERCEL_GIT_REPO_SLUG, this.gitProvider = e?.gitProvider || process.env.GIT_PROVIDER, this.serviceDisplayName = e?.serviceDisplayName || process.env.SERVICE_DISPLAY_NAME, 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();
65
- const t = (function() {
66
- return process.env.KUBERNETES_SERVICE_HOST || f("/var/run/secrets/kubernetes.io/serviceaccount/token") ? { type: "Kubernetes", details: { namespace: process.env.POD_NAMESPACE || "", podName: process.env.HOSTNAME || "", nodeName: process.env.NODE_NAME || "" } } : process.env.AWS_LAMBDA_FUNCTION_NAME ? { type: "AWS Lambda", details: { functionName: process.env.AWS_LAMBDA_FUNCTION_NAME || "", region: process.env.AWS_REGION || "", runtime: process.env.AWS_EXECUTION_ENV || "" } } : process.env.AWS_EXECUTION_ENV ? { type: "AWS", details: { executionEnv: process.env.AWS_EXECUTION_ENV || "", region: process.env.AWS_REGION || "" } } : process.env.GOOGLE_CLOUD_PROJECT ? { type: "Google Cloud", details: { project: process.env.GOOGLE_CLOUD_PROJECT || "" } } : process.env.AZURE_FUNCTIONS_ENVIRONMENT ? { type: "Azure Functions", details: { environment: process.env.AZURE_FUNCTIONS_ENVIRONMENT || "" } } : process.env.VERCEL ? { type: "Vercel", details: { env: process.env.VERCEL_ENV || "", region: process.env.VERCEL_REGION || "" } } : process.env.NETLIFY ? { type: "Netlify", details: {} } : process.env.FLY_APP_NAME ? { type: "Fly.io", details: { appName: process.env.FLY_APP_NAME || "", region: process.env.FLY_REGION || "" } } : process.env.RENDER_SERVICE_ID ? { type: "Render", details: { serviceId: process.env.RENDER_SERVICE_ID || "" } } : process.env.RAILWAY_ENVIRONMENT ? { type: "Railway", details: { environment: process.env.RAILWAY_ENVIRONMENT || "" } } : f("/.dockerenv") ? { type: "Docker", details: {} } : { type: "Unknown", details: { os: R.platform(), arch: R.arch(), nodeVersion: process.version } };
64
+ 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 = I(), this.serviceVersion = e?.serviceVersion || process.env.SERVICE_VERSION, this.gitSha = e?.gitSha || process.env.GIT_SHA || process.env.GITHUB_SHA || process.env.CI_COMMIT_SHA || process.env.BITBUCKET_COMMIT || process.env.VERCEL_GIT_COMMIT_SHA || process.env.CIRCLE_SHA1 || process.env.HEROKU_SLUG_COMMIT || process.env.RENDER_GIT_COMMIT || process.env.RAILWAY_GIT_COMMIT_SHA || process.env.CODEBUILD_RESOLVED_SOURCE_VERSION;
65
+ const t = process.env.GITHUB_REPOSITORY?.split("/");
66
+ this.gitOrg = e?.gitOrg || process.env.GIT_ORG || (t && t.length >= 2 ? t[0] : void 0) || process.env.CI_PROJECT_NAMESPACE || process.env.BITBUCKET_REPO_OWNER || process.env.VERCEL_GIT_REPO_OWNER || process.env.CIRCLE_PROJECT_USERNAME, this.gitRepo = e?.gitRepo || process.env.GIT_REPO || (t && t.length >= 2 ? t.slice(1).join("/") : void 0) || process.env.CI_PROJECT_NAME || process.env.BITBUCKET_REPO_SLUG || process.env.VERCEL_GIT_REPO_SLUG || process.env.CIRCLE_PROJECT_REPONAME, this.gitProvider = e?.gitProvider || process.env.GIT_PROVIDER || (process.env.GITHUB_ACTIONS ? "github" : void 0) || (process.env.GITLAB_CI ? "gitlab" : void 0) || (process.env.BITBUCKET_PIPELINE_UUID ? "bitbucket" : void 0) || (process.env.CIRCLECI ? "circleci" : void 0), this.serviceDisplayName = e?.serviceDisplayName || process.env.SERVICE_DISPLAY_NAME, 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();
67
+ const r = (function() {
68
+ return process.env.KUBERNETES_SERVICE_HOST || R("/var/run/secrets/kubernetes.io/serviceaccount/token") ? { type: "Kubernetes", details: { namespace: process.env.POD_NAMESPACE || "", podName: process.env.HOSTNAME || "", nodeName: process.env.NODE_NAME || "" } } : process.env.AWS_LAMBDA_FUNCTION_NAME ? { type: "AWS Lambda", details: { functionName: process.env.AWS_LAMBDA_FUNCTION_NAME || "", region: process.env.AWS_REGION || "", runtime: process.env.AWS_EXECUTION_ENV || "" } } : process.env.AWS_EXECUTION_ENV ? { type: "AWS", details: { executionEnv: process.env.AWS_EXECUTION_ENV || "", region: process.env.AWS_REGION || "" } } : process.env.GOOGLE_CLOUD_PROJECT ? { type: "Google Cloud", details: { project: process.env.GOOGLE_CLOUD_PROJECT || "" } } : process.env.AZURE_FUNCTIONS_ENVIRONMENT ? { type: "Azure Functions", details: { environment: process.env.AZURE_FUNCTIONS_ENVIRONMENT || "" } } : process.env.VERCEL ? { type: "Vercel", details: { env: process.env.VERCEL_ENV || "", region: process.env.VERCEL_REGION || "" } } : process.env.NETLIFY ? { type: "Netlify", details: {} } : process.env.FLY_APP_NAME ? { type: "Fly.io", details: { appName: process.env.FLY_APP_NAME || "", region: process.env.FLY_REGION || "" } } : process.env.RENDER_SERVICE_ID ? { type: "Render", details: { serviceId: process.env.RENDER_SERVICE_ID || "" } } : process.env.RAILWAY_ENVIRONMENT ? { type: "Railway", details: { environment: process.env.RAILWAY_ENVIRONMENT || "" } } : R("/.dockerenv") ? { type: "Docker", details: {} } : { type: "Unknown", details: { os: T.platform(), arch: T.arch(), nodeVersion: process.version } };
67
69
  })();
68
- this.infrastructureType = t.type, this.infrastructureDetails = t.details;
69
- const r = process.env.SF_LOG_IGNORE_REGEX;
70
- if (r) try {
71
- this.logIgnoreRegex = new RegExp(r);
70
+ this.infrastructureType = r.type, this.infrastructureDetails = r.details;
71
+ const i = process.env.SF_LOG_IGNORE_REGEX;
72
+ if (i) try {
73
+ this.logIgnoreRegex = new RegExp(i);
72
74
  } catch {
73
75
  }
74
76
  this.captureRequestHeaders = process.env.SF_NETWORKHOP_CAPTURE_REQUEST_HEADERS === "true", this.captureResponseHeaders = process.env.SF_NETWORKHOP_CAPTURE_RESPONSE_HEADERS === "true", this.captureRequestBody = process.env.SF_NETWORKHOP_CAPTURE_REQUEST_BODY === "true", this.captureResponseBody = process.env.SF_NETWORKHOP_CAPTURE_RESPONSE_BODY === "true";
75
- const i = parseInt(process.env.SF_NETWORKHOP_REQUEST_LIMIT_MB || "1", 10);
76
- this.requestBodyLimitBytes = 1024 * (isNaN(i) ? 1 : i) * 1024;
77
- const o = parseInt(process.env.SF_NETWORKHOP_RESPONSE_LIMIT_MB || "1", 10);
78
- this.responseBodyLimitBytes = 1024 * (isNaN(o) ? 1 : o) * 1024;
77
+ const o = parseInt(process.env.SF_NETWORKHOP_REQUEST_LIMIT_MB || "1", 10);
78
+ this.requestBodyLimitBytes = 1024 * (isNaN(o) ? 1 : o) * 1024;
79
+ const a = parseInt(process.env.SF_NETWORKHOP_RESPONSE_LIMIT_MB || "1", 10);
80
+ this.responseBodyLimitBytes = 1024 * (isNaN(a) ? 1 : a) * 1024;
79
81
  }
80
82
  getPackageVersion() {
81
83
  return "0.2.14";
@@ -87,103 +89,103 @@ class V {
87
89
  this._serviceIdentificationReceived = e;
88
90
  }
89
91
  }
90
- async function B(n) {
92
+ async function w(n) {
91
93
  if (!(n.gitOrg && n.gitRepo && n.gitProvider)) try {
92
94
  const e = await (async function() {
93
95
  let t = "";
94
96
  try {
95
97
  t = await new Promise((r, i) => {
96
- U("git", ["remote", "get-url", "origin"], { timeout: 3e3 }, (o, p) => {
97
- o ? i(o) : r((p || "").trim());
98
+ P("git", ["remote", "get-url", "origin"], { timeout: 3e3 }, (o, a) => {
99
+ o ? i(o) : r((a || "").trim());
98
100
  });
99
101
  });
100
102
  } catch {
101
103
  try {
102
- const r = (await x.readFile(".git/config", "utf-8")).match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);
104
+ const r = (await M.readFile(".git/config", "utf-8")).match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);
103
105
  r && (t = r[1].trim());
104
106
  } catch {
105
107
  }
106
108
  }
107
109
  return t ? (function(r) {
108
- let i, o, p;
110
+ let i, o, a;
109
111
  if (r.includes("github.com") ? i = "github" : r.includes("gitlab.com") ? i = "gitlab" : r.includes("bitbucket.org") && (i = "bitbucket"), r.startsWith("https://") || r.startsWith("http://")) {
110
112
  const d = r.split("/");
111
- d.length >= 5 && (o = d[3], p = d[4].replace(/\.git$/, ""));
113
+ d.length >= 5 && (o = d[3], a = d[4].replace(/\.git$/, ""));
112
114
  } else {
113
115
  const d = r.indexOf(":");
114
116
  if (d > 0) {
115
- const _ = r.substring(d + 1).replace(/\.git$/, "").split("/");
116
- _.length >= 2 && (o = _[0], p = _[1]);
117
+ const C = r.substring(d + 1).replace(/\.git$/, "").split("/");
118
+ C.length >= 2 && (o = C[0], a = C[1]);
117
119
  }
118
120
  }
119
- return { org: o, repo: p, provider: i };
121
+ return { org: o, repo: a, provider: i };
120
122
  })(t) : {};
121
123
  })();
122
124
  n.gitOrg || (n.gitOrg = e.org), n.gitRepo || (n.gitRepo = e.repo), n.gitProvider || (n.gitProvider = e.provider);
123
125
  } catch {
124
126
  }
125
127
  }
126
- const m = Symbol.for("sailfish.sf_config");
127
- function y() {
128
- return globalThis[m];
128
+ const L = Symbol.for("sailfish.sf_config");
129
+ function m() {
130
+ return globalThis[L];
129
131
  }
130
132
  function W(n) {
131
- const e = y();
133
+ const e = m();
132
134
  if (e) return { config: e };
133
- const t = new V(n);
135
+ const t = new x(n);
134
136
  return (function(r) {
135
- globalThis[m] = r;
137
+ globalThis[L] = r;
136
138
  })(t), t.sfDebug && console.log("[[getOrCreateConfig]] Created global config:", t), { config: t };
137
139
  }
138
- function v() {
139
- const n = y();
140
+ function h() {
141
+ const n = m();
140
142
  if (!n) throw new Error("Configuration has not been initialized. Call getOrCreateConfig(options) first.");
141
143
  return n;
142
144
  }
143
- const O = Symbol.for("sf.ctx.storeAls"), c = globalThis, C = c[O] ?? (c[O] = new D()), M = ["identitytoolkit.googleapis.com", "t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com"], T = Symbol.for("sf.ctx.als"), E = c[T] ?? (c[T] = new D()), A = Symbol.for("sf.ctx.sessionRegistry"), g = c[A] ?? (c[A] = /* @__PURE__ */ new Map()), l = { handledExceptions: /* @__PURE__ */ new Set(), reentrancyGuardLoggingActive: !1, reentrancyGuardLoggingPreActive: !1, reentrancyGuardPrintActive: !1, reentrancyGuardPrintPreActive: !1, reentrancyGuardExceptionActive: !1, reentrancyGuardExceptionPreActive: !1, excludedDomains: new Set(M), supportedDomains: /* @__PURE__ */ new Set() }, u = class u {
145
+ const f = Symbol.for("sf.ctx.storeAls"), p = globalThis, S = p[f] ?? (p[f] = new D()), G = ["identitytoolkit.googleapis.com", "t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com"], N = Symbol.for("sf.ctx.als"), g = p[N] ?? (p[N] = new D()), A = Symbol.for("sf.ctx.sessionRegistry"), E = p[A] ?? (p[A] = /* @__PURE__ */ new Map()), l = { handledExceptions: /* @__PURE__ */ new Set(), reentrancyGuardLoggingActive: !1, reentrancyGuardLoggingPreActive: !1, reentrancyGuardPrintActive: !1, reentrancyGuardPrintPreActive: !1, reentrancyGuardExceptionActive: !1, reentrancyGuardExceptionPreActive: !1, excludedDomains: new Set(G), supportedDomains: /* @__PURE__ */ new Set() }, u = class u {
144
146
  constructor() {
145
147
  }
146
148
  current() {
147
- return C.getStore();
149
+ return S.getStore();
148
150
  }
149
151
  ensureStore() {
150
152
  const e = this.current();
151
153
  if (e) return e;
152
154
  const t = /* @__PURE__ */ new Map();
153
- return C.enterWith(t), t;
155
+ return S.enterWith(t), t;
154
156
  }
155
157
  runWith(e, t) {
156
158
  const r = this.current() ?? /* @__PURE__ */ new Map(), i = new Map(r);
157
- for (const [o, p] of Object.entries(e)) i.set(o, p);
158
- return C.run(i, t);
159
+ for (const [o, a] of Object.entries(e)) i.set(o, a);
160
+ return S.run(i, t);
159
161
  }
160
162
  static getInstance() {
161
- return c[u.GLOBAL_MANAGER_SYMBOL] || (c[u.GLOBAL_MANAGER_SYMBOL] = new u()), c[u.GLOBAL_MANAGER_SYMBOL];
163
+ return p[u.GLOBAL_MANAGER_SYMBOL] || (p[u.GLOBAL_MANAGER_SYMBOL] = new u()), p[u.GLOBAL_MANAGER_SYMBOL];
162
164
  }
163
165
  getCurrentContext() {
164
- return E.getStore() || l;
166
+ return g.getStore() || l;
165
167
  }
166
168
  setCurrentContext(e) {
167
- const t = E.getStore() || l;
168
- E.enterWith({ ...t, ...e });
169
+ const t = g.getStore() || l;
170
+ g.enterWith({ ...t, ...e });
169
171
  }
170
172
  ensureSession(e) {
171
- let t = g.get(e);
172
- return t || (t = { ...l }, g.set(e, t)), t;
173
+ let t = E.get(e);
174
+ return t || (t = { ...l }, E.set(e, t)), t;
173
175
  }
174
176
  getContextFor(e) {
175
- return g.get(e) ?? l;
177
+ return E.get(e) ?? l;
176
178
  }
177
179
  updateContextFor(e, t) {
178
180
  const r = this.ensureSession(e);
179
- g.set(e, { ...r, ...t });
181
+ E.set(e, { ...r, ...t });
180
182
  }
181
183
  runWithSession(e, t) {
182
184
  const r = { ...this.ensureSession(e) };
183
- return E.run(r, t);
185
+ return g.run(r, t);
184
186
  }
185
187
  deleteSession(e) {
186
- g.delete(e);
188
+ E.delete(e);
187
189
  }
188
190
  getTraceId() {
189
191
  return this.getCurrentContext().traceId;
@@ -208,11 +210,11 @@ const O = Symbol.for("sf.ctx.storeAls"), c = globalThis, C = c[O] ?? (c[O] = new
208
210
  }
209
211
  getOrSetSfTraceId(e, t = !1) {
210
212
  let r = this.getTraceId();
211
- return r || (r = e || (t ? h() : `nonsession-applogs-v3/${v().apiKey}/${h()}`), this.setTraceId(r), v().sfDebug && console.log(" Created new trace ID:", r), r);
213
+ return r || (r = e || (t ? I() : `nonsession-applogs-v3/${h().apiKey}/${I()}`), this.setTraceId(r), h().sfDebug && console.log(" Created new trace ID:", r), r);
212
214
  }
213
215
  getOrSetPageVisitUUID() {
214
216
  let e = this.getPageVisitUUID();
215
- return e || (e = h(), this.setPageVisitUUID(e), v().sfDebug && console.log(" Created new page visit UUID:", e), e);
217
+ return e || (e = I(), this.setPageVisitUUID(e), h().sfDebug && console.log(" Created new page visit UUID:", e), e);
216
218
  }
217
219
  getHandledExceptions() {
218
220
  return this.getCurrentContext().handledExceptions;
@@ -244,24 +246,24 @@ const O = Symbol.for("sf.ctx.storeAls"), c = globalThis, C = c[O] ?? (c[O] = new
244
246
  }
245
247
  };
246
248
  s(u, "GLOBAL_MANAGER_SYMBOL", Symbol.for("sf.ctx.manager"));
247
- let I = u;
248
- function k(n) {
249
- const e = { ...I.getInstance().getCurrentContext() };
250
- E.run(e, () => {
249
+ let _ = u;
250
+ function K(n) {
251
+ const e = { ..._.getInstance().getCurrentContext() };
252
+ g.run(e, () => {
251
253
  n();
252
254
  });
253
255
  }
254
- function K() {
255
- return I.getInstance().getCurrentFunctionSpanId();
256
+ function k() {
257
+ return _.getInstance().getCurrentFunctionSpanId();
256
258
  }
257
259
  export {
258
- I as C,
259
- M as D,
260
- y as a,
261
- K as b,
260
+ _ as C,
261
+ G as D,
262
+ m as a,
263
+ k as b,
262
264
  W as c,
263
- B as d,
264
- v as g,
265
- k as r,
266
- h as v
265
+ w as d,
266
+ h as g,
267
+ K as r,
268
+ I as v
267
269
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("fs"),r=require("../funcSpanTransformer-D0W2t41q.cjs"),c=require("../runtimeConfig-B8LSswM8.cjs");function l(o={}){try{if(c.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Esbuild Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-esbuild-disabled",setup(){}}}catch{}const{enabled:a=!0,includeNodeModules:i=[],debug:t=!1}=o;return{name:"sailfish-funcspan-esbuild",setup(u){a&&(u.onLoad({filter:/\.(js|ts|jsx|tsx)$/},async e=>{if(e.path.includes("node_modules")&&!i.some(n=>e.path.includes(`node_modules/${n}`))||e.path.includes("@sailfish-ai/sf-veritas")||e.path.includes("jsts-backend/dist"))return null;try{const n=d.readFileSync(e.path,"utf-8"),s=await r.transformFunctionSpans(n,e.path,{projectRoot:process.cwd(),includeNodeModules:i,debug:t});if(s.modified)return{contents:s.code,loader:e.path.endsWith(".ts")||e.path.endsWith(".tsx")?"ts":"js"}}catch(n){t&&console.error(`[FuncSpan Esbuild] Error transforming ${e.path}:`,n)}return null}),t&&console.log("[FuncSpan Esbuild] Plugin initialized"))}}}exports.default=l,exports.funcspanEsbuildPlugin=l;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("fs"),r=require("../funcSpanTransformer-D0W2t41q.cjs"),c=require("../runtimeConfig-DmD4lUhG.cjs");function l(o={}){try{if(c.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Esbuild Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-esbuild-disabled",setup(){}}}catch{}const{enabled:a=!0,includeNodeModules:i=[],debug:t=!1}=o;return{name:"sailfish-funcspan-esbuild",setup(u){a&&(u.onLoad({filter:/\.(js|ts|jsx|tsx)$/},async e=>{if(e.path.includes("node_modules")&&!i.some(n=>e.path.includes(`node_modules/${n}`))||e.path.includes("@sailfish-ai/sf-veritas")||e.path.includes("jsts-backend/dist"))return null;try{const n=d.readFileSync(e.path,"utf-8"),s=await r.transformFunctionSpans(n,e.path,{projectRoot:process.cwd(),includeNodeModules:i,debug:t});if(s.modified)return{contents:s.code,loader:e.path.endsWith(".ts")||e.path.endsWith(".tsx")?"ts":"js"}}catch(n){t&&console.error(`[FuncSpan Esbuild] Error transforming ${e.path}:`,n)}return null}),t&&console.log("[FuncSpan Esbuild] Plugin initialized"))}}}exports.default=l,exports.funcspanEsbuildPlugin=l;
@@ -1,6 +1,6 @@
1
1
  import { readFileSync as l } from "fs";
2
2
  import { t as d } from "../funcSpanTransformer-S_WeAt_m.js";
3
- import { s as r } from "../runtimeConfig-GwWjhV9M.js";
3
+ import { s as r } from "../runtimeConfig-Bfqf33tO.js";
4
4
  function h(o = {}) {
5
5
  try {
6
6
  if (r()) return console.warn("[FuncSpan Esbuild Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"), { name: "sailfish-funcspan-esbuild-disabled", setup() {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../funcSpanTransformer-D0W2t41q.cjs"),a=require("../runtimeConfig-B8LSswM8.cjs");function s(o={}){try{if(a.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Rollup Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-rollup-disabled"}}catch{}const{enabled:t=!0,includeNodeModules:l=[],debug:u=!1}=o;return{name:"sailfish-funcspan-rollup",async transform(r,e){if(!t||!e.match(/\.(js|ts|jsx|tsx)$/)||e.includes("node_modules")&&!l.some(n=>e.includes(`node_modules/${n}`))||e.includes("@sailfish-ai/sf-veritas")||e.includes("jsts-backend/dist"))return null;try{const n=await i.transformFunctionSpans(r,e,{projectRoot:process.cwd(),includeNodeModules:l,debug:u});if(n.modified)return{code:n.code,map:n.map||null}}catch(n){u&&console.error(`[FuncSpan Rollup] Error transforming ${e}:`,n)}return null}}}exports.default=s,exports.funcspanRollupPlugin=s;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../funcSpanTransformer-D0W2t41q.cjs"),a=require("../runtimeConfig-DmD4lUhG.cjs");function s(o={}){try{if(a.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Rollup Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-rollup-disabled"}}catch{}const{enabled:t=!0,includeNodeModules:l=[],debug:u=!1}=o;return{name:"sailfish-funcspan-rollup",async transform(r,e){if(!t||!e.match(/\.(js|ts|jsx|tsx)$/)||e.includes("node_modules")&&!l.some(n=>e.includes(`node_modules/${n}`))||e.includes("@sailfish-ai/sf-veritas")||e.includes("jsts-backend/dist"))return null;try{const n=await i.transformFunctionSpans(r,e,{projectRoot:process.cwd(),includeNodeModules:l,debug:u});if(n.modified)return{code:n.code,map:n.map||null}}catch(n){u&&console.error(`[FuncSpan Rollup] Error transforming ${e}:`,n)}return null}}}exports.default=s,exports.funcspanRollupPlugin=s;
@@ -1,5 +1,5 @@
1
1
  import { t as i } from "../funcSpanTransformer-S_WeAt_m.js";
2
- import { s as r } from "../runtimeConfig-GwWjhV9M.js";
2
+ import { s as r } from "../runtimeConfig-Bfqf33tO.js";
3
3
  function c(o = {}) {
4
4
  try {
5
5
  if (r()) return console.warn("[FuncSpan Rollup Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"), { name: "sailfish-funcspan-rollup-disabled" };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("fs"),_=require("glob"),N=require("path"),m=require("../funcSpanTransformer-D0W2t41q.cjs"),T=require("../runtimeConfig-B8LSswM8.cjs");async function S(n={}){try{if(T.shouldEnableRuntimeHooks())return void console.warn("[FuncSpan TSC Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation")}catch{}const{outDir:f="dist",include:F=["**/*.js"],exclude:g=["**/*.test.js","**/*.spec.js","**/__tests__/**"],projectRoot:c=process.cwd(),includeNodeModules:C=[],debug:s=!1}=n,u=N.resolve(c,f);console.log("[FuncSpan TSC] Starting post-build function instrumentation..."),console.log(`[FuncSpan TSC] Output directory: ${u}`),console.log(`[FuncSpan TSC] Project root: ${c}`);const r=[];for(const e of F){const t=_.sync(e,{cwd:u,absolute:!0,ignore:g});r.push(...t)}console.log(`[FuncSpan TSC] Found ${r.length} JavaScript files to process`);let l=0,a=0;for(const e of r)try{const t=i.readFileSync(e,"utf-8"),o=await m.transformFunctionSpans(t,e,{projectRoot:c,includeNodeModules:C,debug:s});if(o.modified){if(i.writeFileSync(e,o.code,"utf-8"),o.map){const p=`${e}.map`;i.writeFileSync(p,JSON.stringify(o.map),"utf-8"),s&&console.log(`[FuncSpan TSC] Generated source map: ${p}`)}l++,a+=o.functionsWrapped,s&&console.log(`[FuncSpan TSC] Modified: ${e} (${o.functionsWrapped} functions)`)}}catch(t){console.error(`[FuncSpan TSC] Error processing ${e}:`,t)}console.log(`[FuncSpan TSC] ✅ Completed: Modified ${l} files, wrapped ${a} functions`)}async function d(){const n={outDir:process.env.SF_FUNCSPAN_OUT_DIR||"dist",debug:process.env.SF_FUNCSPAN_DEBUG==="true",includeNodeModules:process.env.SF_FUNCSPAN_INCLUDE_NODE_MODULES?process.env.SF_FUNCSPAN_INCLUDE_NODE_MODULES.split(","):[]};await S(n)}require.main===module&&d().catch(n=>{console.error("[FuncSpan TSC] Fatal error:",n),process.exit(1)}),exports.cli=d,exports.processTscFiles=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("fs"),_=require("glob"),N=require("path"),m=require("../funcSpanTransformer-D0W2t41q.cjs"),T=require("../runtimeConfig-DmD4lUhG.cjs");async function S(n={}){try{if(T.shouldEnableRuntimeHooks())return void console.warn("[FuncSpan TSC Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation")}catch{}const{outDir:f="dist",include:F=["**/*.js"],exclude:g=["**/*.test.js","**/*.spec.js","**/__tests__/**"],projectRoot:c=process.cwd(),includeNodeModules:C=[],debug:s=!1}=n,u=N.resolve(c,f);console.log("[FuncSpan TSC] Starting post-build function instrumentation..."),console.log(`[FuncSpan TSC] Output directory: ${u}`),console.log(`[FuncSpan TSC] Project root: ${c}`);const r=[];for(const e of F){const t=_.sync(e,{cwd:u,absolute:!0,ignore:g});r.push(...t)}console.log(`[FuncSpan TSC] Found ${r.length} JavaScript files to process`);let l=0,a=0;for(const e of r)try{const t=i.readFileSync(e,"utf-8"),o=await m.transformFunctionSpans(t,e,{projectRoot:c,includeNodeModules:C,debug:s});if(o.modified){if(i.writeFileSync(e,o.code,"utf-8"),o.map){const p=`${e}.map`;i.writeFileSync(p,JSON.stringify(o.map),"utf-8"),s&&console.log(`[FuncSpan TSC] Generated source map: ${p}`)}l++,a+=o.functionsWrapped,s&&console.log(`[FuncSpan TSC] Modified: ${e} (${o.functionsWrapped} functions)`)}}catch(t){console.error(`[FuncSpan TSC] Error processing ${e}:`,t)}console.log(`[FuncSpan TSC] ✅ Completed: Modified ${l} files, wrapped ${a} functions`)}async function d(){const n={outDir:process.env.SF_FUNCSPAN_OUT_DIR||"dist",debug:process.env.SF_FUNCSPAN_DEBUG==="true",includeNodeModules:process.env.SF_FUNCSPAN_INCLUDE_NODE_MODULES?process.env.SF_FUNCSPAN_INCLUDE_NODE_MODULES.split(","):[]};await S(n)}require.main===module&&d().catch(n=>{console.error("[FuncSpan TSC] Fatal error:",n),process.exit(1)}),exports.cli=d,exports.processTscFiles=S;
@@ -2,7 +2,7 @@ import { readFileSync as m, writeFileSync as l } from "fs";
2
2
  import { sync as g } from "glob";
3
3
  import { resolve as C } from "path";
4
4
  import { t as _ } from "../funcSpanTransformer-S_WeAt_m.js";
5
- import { s as N } from "../runtimeConfig-GwWjhV9M.js";
5
+ import { s as N } from "../runtimeConfig-Bfqf33tO.js";
6
6
  async function D(n = {}) {
7
7
  try {
8
8
  if (N()) return void console.warn("[FuncSpan TSC Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation");
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../funcSpanTransformer-D0W2t41q.cjs"),l=require("../runtimeConfig-B8LSswM8.cjs");exports.funcspanVitePlugin=function(s={}){try{if(l.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Vite Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-vite-disabled"}}catch{}const{enabled:o=!0,includeNodeModules:t=[],debug:i=!1}=s;return{name:"sailfish-funcspan-vite",enforce:"pre",async transform(u,e){if(!o||!e.match(/\.(js|ts|jsx|tsx)$/)||e.startsWith("\0")||e.includes("node_modules")&&!t.some(n=>e.includes(`node_modules/${n}`))||e.includes("@sailfish-ai/sf-veritas")||e.includes("jsts-backend/dist"))return null;try{const n=await r.transformFunctionSpans(u,e,{projectRoot:process.cwd(),includeNodeModules:t,debug:i});if(n.modified)return{code:n.code,map:null}}catch(n){i&&console.error(`[FuncSpan Vite] Error transforming ${e}:`,n)}return null}}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../funcSpanTransformer-D0W2t41q.cjs"),l=require("../runtimeConfig-DmD4lUhG.cjs");exports.funcspanVitePlugin=function(s={}){try{if(l.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Vite Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-vite-disabled"}}catch{}const{enabled:o=!0,includeNodeModules:t=[],debug:i=!1}=s;return{name:"sailfish-funcspan-vite",enforce:"pre",async transform(u,e){if(!o||!e.match(/\.(js|ts|jsx|tsx)$/)||e.startsWith("\0")||e.includes("node_modules")&&!t.some(n=>e.includes(`node_modules/${n}`))||e.includes("@sailfish-ai/sf-veritas")||e.includes("jsts-backend/dist"))return null;try{const n=await r.transformFunctionSpans(u,e,{projectRoot:process.cwd(),includeNodeModules:t,debug:i});if(n.modified)return{code:n.code,map:null}}catch(n){i&&console.error(`[FuncSpan Vite] Error transforming ${e}:`,n)}return null}}};
@@ -1,5 +1,5 @@
1
1
  import { t as o } from "../funcSpanTransformer-S_WeAt_m.js";
2
- import { s as l } from "../runtimeConfig-GwWjhV9M.js";
2
+ import { s as l } from "../runtimeConfig-Bfqf33tO.js";
3
3
  function d(u = {}) {
4
4
  try {
5
5
  if (l()) return console.warn("[FuncSpan Vite Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"), { name: "sailfish-funcspan-vite-disabled" };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("../runtimeConfig-B8LSswM8.cjs"),a=require("path"),P=require("url");function m(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:()=>r[n]})}}return o.default=r,Object.freeze(o)}const f=m(a);class u{options;constructor(o={}){this.options={enabled:!0,includeNodeModules:[],debug:!1,enableWorkerPoolTracking:!1,workerPoolTrackDns:!1,workerPoolTrackFs:!1,workerPoolTrackCrypto:!1,workerPoolTrackZlib:!1,...o}}apply(o){try{if(b.shouldEnableRuntimeHooks())return void console.warn("[FuncSpan Webpack Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation")}catch{}const{enabled:n,includeNodeModules:t,debug:c}=this.options;if(!n)return;const l="FuncspanWebpackPlugin";o.hooks.compilation.tap(l,s=>{s.hooks.buildModule.tap(l,i=>{i.resource&&i.resource.match(/\.(js|ts|jsx|tsx)$/)&&(!i.resource.includes("node_modules")||t?.some(e=>i.resource.includes(`node_modules/${e}`)))}),o.webpack.NormalModule.getCompilationHooks(s).loader.tap(l,(i,e)=>{if(!e.resource||!e.resource.match(/\.(js|ts|jsx|tsx)$/)||e.resource.includes("node_modules")&&!t?.some(p=>e.resource.includes(`node_modules/${p}`)))return;const d=typeof __dirname<"u"?__dirname:a.dirname(P.fileURLToPath(require("node:url").pathToFileURL(__filename).href)),k=f.join(d,"funcspanWebpackLoader.cjs");e.loaders.push({loader:k,options:{projectRoot:o.context,includeNodeModules:t,debug:c,enableWorkerPoolTracking:this.options.enableWorkerPoolTracking,workerPoolTrackDns:this.options.workerPoolTrackDns,workerPoolTrackFs:this.options.workerPoolTrackFs,workerPoolTrackCrypto:this.options.workerPoolTrackCrypto,workerPoolTrackZlib:this.options.workerPoolTrackZlib}})})}),c&&console.log("[FuncSpan Webpack] Plugin initialized")}}exports.FuncspanWebpackPlugin=u,exports.default=u;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("../runtimeConfig-DmD4lUhG.cjs"),a=require("path"),P=require("url");function m(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:()=>r[n]})}}return o.default=r,Object.freeze(o)}const f=m(a);class u{options;constructor(o={}){this.options={enabled:!0,includeNodeModules:[],debug:!1,enableWorkerPoolTracking:!1,workerPoolTrackDns:!1,workerPoolTrackFs:!1,workerPoolTrackCrypto:!1,workerPoolTrackZlib:!1,...o}}apply(o){try{if(b.shouldEnableRuntimeHooks())return void console.warn("[FuncSpan Webpack Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation")}catch{}const{enabled:n,includeNodeModules:t,debug:c}=this.options;if(!n)return;const l="FuncspanWebpackPlugin";o.hooks.compilation.tap(l,s=>{s.hooks.buildModule.tap(l,i=>{i.resource&&i.resource.match(/\.(js|ts|jsx|tsx)$/)&&(!i.resource.includes("node_modules")||t?.some(e=>i.resource.includes(`node_modules/${e}`)))}),o.webpack.NormalModule.getCompilationHooks(s).loader.tap(l,(i,e)=>{if(!e.resource||!e.resource.match(/\.(js|ts|jsx|tsx)$/)||e.resource.includes("node_modules")&&!t?.some(p=>e.resource.includes(`node_modules/${p}`)))return;const d=typeof __dirname<"u"?__dirname:a.dirname(P.fileURLToPath(require("node:url").pathToFileURL(__filename).href)),k=f.join(d,"funcspanWebpackLoader.cjs");e.loaders.push({loader:k,options:{projectRoot:o.context,includeNodeModules:t,debug:c,enableWorkerPoolTracking:this.options.enableWorkerPoolTracking,workerPoolTrackDns:this.options.workerPoolTrackDns,workerPoolTrackFs:this.options.workerPoolTrackFs,workerPoolTrackCrypto:this.options.workerPoolTrackCrypto,workerPoolTrackZlib:this.options.workerPoolTrackZlib}})})}),c&&console.log("[FuncSpan Webpack] Plugin initialized")}}exports.FuncspanWebpackPlugin=u,exports.default=u;
@@ -1,7 +1,7 @@
1
1
  var k = Object.defineProperty;
2
2
  var m = (r, o, s) => o in r ? k(r, o, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[o] = s;
3
3
  var c = (r, o, s) => m(r, typeof o != "symbol" ? o + "" : o, s);
4
- import { s as b } from "../runtimeConfig-GwWjhV9M.js";
4
+ import { s as b } from "../runtimeConfig-Bfqf33tO.js";
5
5
  import * as P from "path";
6
6
  import { dirname as T } from "path";
7
7
  import { fileURLToPath as f } from "url";