@interfere/node 0.1.0-canary.6 → 0.1.0-canary.7
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/capture.d.cts +1 -2
- package/dist/capture.d.mts +1 -2
- package/dist/capture.mjs +1 -2
- package/dist/init.d.cts +1 -2
- package/dist/init.d.mts +1 -2
- package/dist/init.mjs +1 -2
- package/dist/internal/dedupe.d.cts +1 -2
- package/dist/internal/dedupe.d.mts +1 -2
- package/dist/internal/dedupe.mjs +1 -2
- package/dist/internal/env.d.cts +1 -2
- package/dist/internal/env.d.mts +1 -2
- package/dist/internal/env.mjs +1 -2
- package/dist/internal/global-handlers.d.cts +1 -2
- package/dist/internal/global-handlers.d.mts +1 -2
- package/dist/internal/global-handlers.mjs +1 -2
- package/dist/internal/normalize-request.d.cts +1 -2
- package/dist/internal/normalize-request.d.mts +1 -2
- package/dist/internal/normalize-request.mjs +1 -2
- package/dist/internal/release-slug.d.cts +1 -2
- package/dist/internal/release-slug.d.mts +1 -2
- package/dist/internal/release-slug.mjs +1 -2
- package/dist/internal/types.d.cts +1 -2
- package/dist/internal/types.d.mts +1 -2
- package/dist/internal/url.d.cts +1 -2
- package/dist/internal/url.d.mts +1 -2
- package/dist/internal/url.mjs +1 -2
- package/dist/internal/version.d.cts +1 -2
- package/dist/internal/version.d.mts +1 -2
- package/dist/internal/version.mjs +1 -2
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -2
- package/package.json +8 -9
package/dist/capture.d.cts
CHANGED
|
@@ -30,5 +30,4 @@ declare function captureMessage(message: string, request?: unknown, errorContext
|
|
|
30
30
|
*/
|
|
31
31
|
declare function withSpan<T>(name: string, fn: () => Promise<T> | T): Promise<T>;
|
|
32
32
|
//#endregion
|
|
33
|
-
export { type CaptureErrorContext, captureError, captureMessage, withSpan };
|
|
34
|
-
//# sourceMappingURL=capture.d.cts.map
|
|
33
|
+
export { type CaptureErrorContext, captureError, captureMessage, withSpan };
|
package/dist/capture.d.mts
CHANGED
|
@@ -30,5 +30,4 @@ declare function captureMessage(message: string, request?: unknown, errorContext
|
|
|
30
30
|
*/
|
|
31
31
|
declare function withSpan<T>(name: string, fn: () => Promise<T> | T): Promise<T>;
|
|
32
32
|
//#endregion
|
|
33
|
-
export { type CaptureErrorContext, captureError, captureMessage, withSpan };
|
|
34
|
-
//# sourceMappingURL=capture.d.mts.map
|
|
33
|
+
export { type CaptureErrorContext, captureError, captureMessage, withSpan };
|
package/dist/capture.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{isErrorCaptured,markErrorCaptured}from"./internal/dedupe.mjs";import{isEnabledInEnvironment}from"./internal/env.mjs";import{normalizeRequest}from"./internal/normalize-request.mjs";import{MECHANISM_TYPE,toError}from"@interfere/types/sdk/errors";import{SpanKind,SpanStatusCode,context,trace}from"@opentelemetry/api";const TRACER_NAME=`@interfere/node`,DEFAULT_ERROR_MECHANISM={type:MECHANISM_TYPE.node.captureError,handled:!0};function captureError(error,request,errorContext){if(!isEnabledInEnvironment()||isErrorCaptured(error))return;markErrorCaptured(error);let err=toError(error),normalizedRequest=normalizeRequest(request),mechanism=errorContext?.mechanism??DEFAULT_ERROR_MECHANISM,span=trace.getTracer(TRACER_NAME).startSpan(`interfere.error.captured`,{kind:SpanKind.INTERNAL},context.active()),requestMethod=errorContext?.node?.requestMethod??normalizedRequest?.method??null;requestMethod&&span.setAttribute(`http.request.method`,requestMethod);let requestPath=errorContext?.node?.requestPath??normalizedRequest?.path??null;requestPath&&span.setAttribute(`url.path`,requestPath);let sessionId=normalizedRequest?.headers.get(`x-interfere-session`);sessionId&&span.setAttribute(`interfere.session.id`,sessionId);let eventAttrs={"exception.type":err.name,"exception.message":err.message,"interfere.exception.mechanism":mechanism.type,"interfere.exception.handled":mechanism.handled};err.stack&&(eventAttrs[`exception.stacktrace`]=err.stack);let digest=errorContext?.node?.errorDigest;digest&&(eventAttrs[`interfere.error.digest`]=digest),span.addEvent(`exception`,eventAttrs),span.setStatus({code:SpanStatusCode.ERROR}),span.end()}function captureMessage(message,request,errorContext){captureError(Error(message),request,errorContext)}async function withSpan(name,fn){let span=trace.getTracer(TRACER_NAME).startSpan(name);try{return await context.with(trace.setSpan(context.active(),span),fn)}catch(error){throw span.recordException(error),span.setStatus({code:SpanStatusCode.ERROR}),error}finally{span.end()}}export{captureError,captureMessage,withSpan};
|
|
2
|
-
//# sourceMappingURL=capture.mjs.map
|
|
1
|
+
import{isErrorCaptured,markErrorCaptured}from"./internal/dedupe.mjs";import{isEnabledInEnvironment}from"./internal/env.mjs";import{normalizeRequest}from"./internal/normalize-request.mjs";import{MECHANISM_TYPE,toError}from"@interfere/types/sdk/errors";import{SpanKind,SpanStatusCode,context,trace}from"@opentelemetry/api";const TRACER_NAME=`@interfere/node`,DEFAULT_ERROR_MECHANISM={type:MECHANISM_TYPE.node.captureError,handled:!0};function captureError(error,request,errorContext){if(!isEnabledInEnvironment()||isErrorCaptured(error))return;markErrorCaptured(error);let err=toError(error),normalizedRequest=normalizeRequest(request),mechanism=errorContext?.mechanism??DEFAULT_ERROR_MECHANISM,span=trace.getTracer(TRACER_NAME).startSpan(`interfere.error.captured`,{kind:SpanKind.INTERNAL},context.active()),requestMethod=errorContext?.node?.requestMethod??normalizedRequest?.method??null;requestMethod&&span.setAttribute(`http.request.method`,requestMethod);let requestPath=errorContext?.node?.requestPath??normalizedRequest?.path??null;requestPath&&span.setAttribute(`url.path`,requestPath);let sessionId=normalizedRequest?.headers.get(`x-interfere-session`);sessionId&&span.setAttribute(`interfere.session.id`,sessionId);let eventAttrs={"exception.type":err.name,"exception.message":err.message,"interfere.exception.mechanism":mechanism.type,"interfere.exception.handled":mechanism.handled};err.stack&&(eventAttrs[`exception.stacktrace`]=err.stack);let digest=errorContext?.node?.errorDigest;digest&&(eventAttrs[`interfere.error.digest`]=digest),span.addEvent(`exception`,eventAttrs),span.setStatus({code:SpanStatusCode.ERROR}),span.end()}function captureMessage(message,request,errorContext){captureError(Error(message),request,errorContext)}async function withSpan(name,fn){let span=trace.getTracer(TRACER_NAME).startSpan(name);try{return await context.with(trace.setSpan(context.active(),span),fn)}catch(error){throw span.recordException(error),span.setStatus({code:SpanStatusCode.ERROR}),error}finally{span.end()}}export{captureError,captureMessage,withSpan};
|
package/dist/init.d.cts
CHANGED
package/dist/init.d.mts
CHANGED
package/dist/init.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import{readInterfereEnv}from"./internal/env.mjs";import{installGlobalHandlers,uninstallGlobalHandlers}from"./internal/global-handlers.mjs";import{resolveReleaseSlug}from"./internal/release-slug.mjs";import{withPublicKey}from"./internal/url.mjs";import{PRODUCER_VERSION}from"./internal/version.mjs";import{API_PATHS}from"@interfere/constants/api";import{LOCAL_DEV_RELEASE_SLUG}from"@interfere/types/releases/slug";import{resolveEnvironment}from"@interfere/types/sdk/runtime";import{AsyncLocalStorageContextManager}from"@opentelemetry/context-async-hooks";import{OTLPTraceExporter}from"@opentelemetry/exporter-trace-otlp-http";import{resourceFromAttributes}from"@opentelemetry/resources";import{BatchSpanProcessor}from"@opentelemetry/sdk-trace-base";import{NodeTracerProvider}from"@opentelemetry/sdk-trace-node";let provider=null;function init(options={}){if(provider)return;let debug=options.debug??process.env.INTERFERE_DEBUG===`1`,env=readInterfereEnv();if(!env.publicKey){console.warn(`[interfere] INTERFERE_PUBLIC_KEY not set; SDK disabled`);return}let environment=resolveEnvironment({explicit:options.environment,env:process.env}),releaseSlug=env.forceEnable?LOCAL_DEV_RELEASE_SLUG:resolveReleaseSlug().slug;releaseSlug||console.warn(`[interfere] No release slug resolved — the collector will reject spans. Add a postbuild script to your package.json:
|
|
2
2
|
"postbuild": "interfere sourcemaps upload ./dist"
|
|
3
|
-
and set INTERFERE_API_KEY in your CI environment. See https://interfere.com/docs/nest#releases`);let serviceName=options.serviceName??process.env.OTEL_SERVICE_NAME??`node-app`,resource=resourceFromAttributes({"service.name":serviceName,...options.serviceNamespace?{"service.namespace":options.serviceNamespace}:{},"deployment.environment.name":environment,"telemetry.sdk.language":`nodejs`,"interfere.sdk.name":`@interfere/node`,"interfere.sdk.version":PRODUCER_VERSION,...releaseSlug?{"release.slug":releaseSlug}:{}}),exporter=new OTLPTraceExporter({url:withPublicKey(`${env.apiUrl}${API_PATHS.SINK}`,env.publicKey),headers:{"user-agent":PRODUCER_VERSION,"x-interfere-producer-version":PRODUCER_VERSION,...env.forceEnable?{"x-interfere-force-enable":`1`}:{}}});if(debug){let orig=exporter.export.bind(exporter);exporter.export=(spans,cb)=>{let t=Date.now();orig(spans,result=>{let ms=Date.now()-t;if(result.code===0)console.log(`[interfere] export: ${spans.length} spans (${ms}ms)`);else{let err=result.error,status=err?.code?` ${err.code}`:``,body=err?.data??err?.message??`unknown error`;console.warn(`[interfere] export failed:${status} ${body} (${ms}ms, ${spans.length} spans dropped)`)}cb(result)})}}if(provider=new NodeTracerProvider({resource,spanProcessors:[new BatchSpanProcessor(exporter)]}),provider.register({contextManager:new AsyncLocalStorageContextManager().enable()}),installGlobalHandlers({captureUncaughtException:options.captureUncaughtException??!0,captureUnhandledRejection:options.captureUnhandledRejection??!0,flush}),debug){let endpoint=withPublicKey(`${env.apiUrl}${API_PATHS.SINK}`,env.publicKey);console.log(`[interfere] init: service=${serviceName}, env=${environment}, endpoint=${endpoint}`),releaseSlug&&console.log(`[interfere] release.slug=${releaseSlug}`)}}async function close(){provider&&=(uninstallGlobalHandlers(),await provider.shutdown(),null)}async function flush(){provider&&await provider.forceFlush()}export{close,flush,init};
|
|
4
|
-
//# sourceMappingURL=init.mjs.map
|
|
3
|
+
and set INTERFERE_API_KEY in your CI environment. See https://interfere.com/docs/nest#releases`);let serviceName=options.serviceName??process.env.OTEL_SERVICE_NAME??`node-app`,resource=resourceFromAttributes({"service.name":serviceName,...options.serviceNamespace?{"service.namespace":options.serviceNamespace}:{},"deployment.environment.name":environment,"telemetry.sdk.language":`nodejs`,"interfere.sdk.name":`@interfere/node`,"interfere.sdk.version":PRODUCER_VERSION,...releaseSlug?{"release.slug":releaseSlug}:{}}),exporter=new OTLPTraceExporter({url:withPublicKey(`${env.apiUrl}${API_PATHS.SINK}`,env.publicKey),headers:{"user-agent":PRODUCER_VERSION,"x-interfere-producer-version":PRODUCER_VERSION,...env.forceEnable?{"x-interfere-force-enable":`1`}:{}}});if(debug){let orig=exporter.export.bind(exporter);exporter.export=(spans,cb)=>{let t=Date.now();orig(spans,result=>{let ms=Date.now()-t;if(result.code===0)console.log(`[interfere] export: ${spans.length} spans (${ms}ms)`);else{let err=result.error,status=err?.code?` ${err.code}`:``,body=err?.data??err?.message??`unknown error`;console.warn(`[interfere] export failed:${status} ${body} (${ms}ms, ${spans.length} spans dropped)`)}cb(result)})}}if(provider=new NodeTracerProvider({resource,spanProcessors:[new BatchSpanProcessor(exporter)]}),provider.register({contextManager:new AsyncLocalStorageContextManager().enable()}),installGlobalHandlers({captureUncaughtException:options.captureUncaughtException??!0,captureUnhandledRejection:options.captureUnhandledRejection??!0,flush}),debug){let endpoint=withPublicKey(`${env.apiUrl}${API_PATHS.SINK}`,env.publicKey);console.log(`[interfere] init: service=${serviceName}, env=${environment}, endpoint=${endpoint}`),releaseSlug&&console.log(`[interfere] release.slug=${releaseSlug}`)}}async function close(){provider&&=(uninstallGlobalHandlers(),await provider.shutdown(),null)}async function flush(){provider&&await provider.forceFlush()}export{close,flush,init};
|
|
@@ -2,5 +2,4 @@
|
|
|
2
2
|
declare function isErrorCaptured(error: unknown): boolean;
|
|
3
3
|
declare function markErrorCaptured(error: unknown): void;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { isErrorCaptured, markErrorCaptured };
|
|
6
|
-
//# sourceMappingURL=dedupe.d.cts.map
|
|
5
|
+
export { isErrorCaptured, markErrorCaptured };
|
|
@@ -2,5 +2,4 @@
|
|
|
2
2
|
declare function isErrorCaptured(error: unknown): boolean;
|
|
3
3
|
declare function markErrorCaptured(error: unknown): void;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { isErrorCaptured, markErrorCaptured };
|
|
6
|
-
//# sourceMappingURL=dedupe.d.mts.map
|
|
5
|
+
export { isErrorCaptured, markErrorCaptured };
|
package/dist/internal/dedupe.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
const seenErrors=new WeakSet;function isErrorCaptured(error){return error instanceof Error&&seenErrors.has(error)}function markErrorCaptured(error){error instanceof Error&&seenErrors.add(error)}export{isErrorCaptured,markErrorCaptured};
|
|
2
|
-
//# sourceMappingURL=dedupe.mjs.map
|
|
1
|
+
const seenErrors=new WeakSet;function isErrorCaptured(error){return error instanceof Error&&seenErrors.has(error)}function markErrorCaptured(error){error instanceof Error&&seenErrors.add(error)}export{isErrorCaptured,markErrorCaptured};
|
package/dist/internal/env.d.cts
CHANGED
|
@@ -14,5 +14,4 @@ interface InterfereEnv {
|
|
|
14
14
|
declare function isEnabledInEnvironment(): boolean;
|
|
15
15
|
declare function readInterfereEnv(): InterfereEnv;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { InterfereEnv, isEnabledInEnvironment, readInterfereEnv };
|
|
18
|
-
//# sourceMappingURL=env.d.cts.map
|
|
17
|
+
export { InterfereEnv, isEnabledInEnvironment, readInterfereEnv };
|
package/dist/internal/env.d.mts
CHANGED
|
@@ -14,5 +14,4 @@ interface InterfereEnv {
|
|
|
14
14
|
declare function isEnabledInEnvironment(): boolean;
|
|
15
15
|
declare function readInterfereEnv(): InterfereEnv;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { InterfereEnv, isEnabledInEnvironment, readInterfereEnv };
|
|
18
|
-
//# sourceMappingURL=env.d.mts.map
|
|
17
|
+
export { InterfereEnv, isEnabledInEnvironment, readInterfereEnv };
|
package/dist/internal/env.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{API_URL}from"@interfere/constants/api";import{parseEnvValue}from"@interfere/types/sdk/env";function isEnabledInEnvironment(){return!0}function readInterfereEnv(){return{apiUrl:parseEnvValue(process.env.INTERFERE_API_URL)??API_URL,forceEnable:process.env.INTERFERE_FORCE_ENABLE===`1`,publicKey:parseEnvValue(process.env.INTERFERE_PUBLIC_KEY)}}export{isEnabledInEnvironment,readInterfereEnv};
|
|
2
|
-
//# sourceMappingURL=env.mjs.map
|
|
1
|
+
import{API_URL}from"@interfere/constants/api";import{parseEnvValue}from"@interfere/types/sdk/env";function isEnabledInEnvironment(){return!0}function readInterfereEnv(){return{apiUrl:parseEnvValue(process.env.INTERFERE_API_URL)??API_URL,forceEnable:process.env.INTERFERE_FORCE_ENABLE===`1`,publicKey:parseEnvValue(process.env.INTERFERE_PUBLIC_KEY)}}export{isEnabledInEnvironment,readInterfereEnv};
|
|
@@ -22,5 +22,4 @@ declare function installGlobalHandlers(options: {
|
|
|
22
22
|
}): void;
|
|
23
23
|
declare function uninstallGlobalHandlers(): void;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { installGlobalHandlers, uninstallGlobalHandlers };
|
|
26
|
-
//# sourceMappingURL=global-handlers.d.cts.map
|
|
25
|
+
export { installGlobalHandlers, uninstallGlobalHandlers };
|
|
@@ -22,5 +22,4 @@ declare function installGlobalHandlers(options: {
|
|
|
22
22
|
}): void;
|
|
23
23
|
declare function uninstallGlobalHandlers(): void;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { installGlobalHandlers, uninstallGlobalHandlers };
|
|
26
|
-
//# sourceMappingURL=global-handlers.d.mts.map
|
|
25
|
+
export { installGlobalHandlers, uninstallGlobalHandlers };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{captureError}from"../capture.mjs";import{MECHANISM_TYPE}from"@interfere/types/sdk/errors";let uncaughtHandler=null,unhandledHandler=null;function installGlobalHandlers(options){options.captureUncaughtException&&uncaughtHandler===null&&(uncaughtHandler=error=>{handleUncaughtException(error,options.flush).catch(()=>void 0)},process.on(`uncaughtException`,uncaughtHandler)),options.captureUnhandledRejection&&unhandledHandler===null&&(unhandledHandler=reason=>{handleUnhandledRejection(reason,options.flush).catch(()=>void 0)},process.on(`unhandledRejection`,unhandledHandler))}function uninstallGlobalHandlers(){uncaughtHandler!==null&&(process.off(`uncaughtException`,uncaughtHandler),uncaughtHandler=null),unhandledHandler!==null&&(process.off(`unhandledRejection`,unhandledHandler),unhandledHandler=null)}async function handleUncaughtException(error,flush){await captureError(error,void 0,{mechanism:{type:MECHANISM_TYPE.node.uncaughtException,handled:!1}}),await flushWithTimeout(flush),process.exit(1)}async function handleUnhandledRejection(reason,flush){await captureError(reason,void 0,{mechanism:{type:MECHANISM_TYPE.node.unhandledRejection,handled:!1}}),await flushWithTimeout(flush)}function flushWithTimeout(flush){return Promise.race([flush(),new Promise(resolve=>{setTimeout(resolve,2e3)})])}export{installGlobalHandlers,uninstallGlobalHandlers};
|
|
2
|
-
//# sourceMappingURL=global-handlers.mjs.map
|
|
1
|
+
import{captureError}from"../capture.mjs";import{MECHANISM_TYPE}from"@interfere/types/sdk/errors";let uncaughtHandler=null,unhandledHandler=null;function installGlobalHandlers(options){options.captureUncaughtException&&uncaughtHandler===null&&(uncaughtHandler=error=>{handleUncaughtException(error,options.flush).catch(()=>void 0)},process.on(`uncaughtException`,uncaughtHandler)),options.captureUnhandledRejection&&unhandledHandler===null&&(unhandledHandler=reason=>{handleUnhandledRejection(reason,options.flush).catch(()=>void 0)},process.on(`unhandledRejection`,unhandledHandler))}function uninstallGlobalHandlers(){uncaughtHandler!==null&&(process.off(`uncaughtException`,uncaughtHandler),uncaughtHandler=null),unhandledHandler!==null&&(process.off(`unhandledRejection`,unhandledHandler),unhandledHandler=null)}async function handleUncaughtException(error,flush){await captureError(error,void 0,{mechanism:{type:MECHANISM_TYPE.node.uncaughtException,handled:!1}}),await flushWithTimeout(flush),process.exit(1)}async function handleUnhandledRejection(reason,flush){await captureError(reason,void 0,{mechanism:{type:MECHANISM_TYPE.node.unhandledRejection,handled:!1}}),await flushWithTimeout(flush)}function flushWithTimeout(flush){return Promise.race([flush(),new Promise(resolve=>{setTimeout(resolve,2e3)})])}export{installGlobalHandlers,uninstallGlobalHandlers};
|
|
@@ -12,5 +12,4 @@ declare const TRACEPARENT_HEADER = "traceparent";
|
|
|
12
12
|
*/
|
|
13
13
|
declare function normalizeRequest(request: unknown): NormalizedRequest | null;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { TRACEPARENT_HEADER, normalizeRequest };
|
|
16
|
-
//# sourceMappingURL=normalize-request.d.cts.map
|
|
15
|
+
export { TRACEPARENT_HEADER, normalizeRequest };
|
|
@@ -12,5 +12,4 @@ declare const TRACEPARENT_HEADER = "traceparent";
|
|
|
12
12
|
*/
|
|
13
13
|
declare function normalizeRequest(request: unknown): NormalizedRequest | null;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { TRACEPARENT_HEADER, normalizeRequest };
|
|
16
|
-
//# sourceMappingURL=normalize-request.d.mts.map
|
|
15
|
+
export { TRACEPARENT_HEADER, normalizeRequest };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
const TRACEPARENT_HEADER=`traceparent`;function normalizeRequest(request){if(request instanceof Request)return{method:normalizeMethod(request.method),path:normalizePath(request.url),headers:request.headers};if(typeof request!=`object`||!request)return null;let value=request;return{method:normalizeMethod(value.method),path:normalizePath(typeof value.path==`string`?value.path:toStringOrDefault(value.url)),headers:normalizeHeaders(value.headers)}}function normalizeMethod(value){if(typeof value!=`string`)return`GET`;let method=value.trim();return method.length>0?method.toUpperCase():`GET`}function normalizePath(value){if(value.length===0)return`/`;try{return new URL(value,`http://localhost`).pathname||`/`}catch{return value.startsWith(`/`)?value:`/${value}`}}function toStringOrDefault(value,fallback=`/`){if(typeof value!=`string`)return fallback;let trimmed=value.trim();return trimmed.length>0?trimmed:fallback}function normalizeHeaders(value){if(value instanceof Headers)return new Headers(value);if(typeof value!=`object`||!value)return new Headers;let headers=new Headers;for(let[key,headerValue]of Object.entries(value))if(headerValue!==void 0){if(Array.isArray(headerValue)){headers.set(key,headerValue.join(`, `));continue}headers.set(key,String(headerValue))}return headers}export{TRACEPARENT_HEADER,normalizeRequest};
|
|
2
|
-
//# sourceMappingURL=normalize-request.mjs.map
|
|
1
|
+
const TRACEPARENT_HEADER=`traceparent`;function normalizeRequest(request){if(request instanceof Request)return{method:normalizeMethod(request.method),path:normalizePath(request.url),headers:request.headers};if(typeof request!=`object`||!request)return null;let value=request;return{method:normalizeMethod(value.method),path:normalizePath(typeof value.path==`string`?value.path:toStringOrDefault(value.url)),headers:normalizeHeaders(value.headers)}}function normalizeMethod(value){if(typeof value!=`string`)return`GET`;let method=value.trim();return method.length>0?method.toUpperCase():`GET`}function normalizePath(value){if(value.length===0)return`/`;try{return new URL(value,`http://localhost`).pathname||`/`}catch{return value.startsWith(`/`)?value:`/${value}`}}function toStringOrDefault(value,fallback=`/`){if(typeof value!=`string`)return fallback;let trimmed=value.trim();return trimmed.length>0?trimmed:fallback}function normalizeHeaders(value){if(value instanceof Headers)return new Headers(value);if(typeof value!=`object`||!value)return new Headers;let headers=new Headers;for(let[key,headerValue]of Object.entries(value))if(headerValue!==void 0){if(Array.isArray(headerValue)){headers.set(key,headerValue.join(`, `));continue}headers.set(key,String(headerValue))}return headers}export{TRACEPARENT_HEADER,normalizeRequest};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{readFirstEnvValue}from"@interfere/types/sdk/env";import{deriveReleaseSlug}from"@interfere/types/releases/slug";import{releaseSourceIdEnvKeys}from"@interfere/types/integrations";import{execSync}from"node:child_process";function runGitCommand(command){try{let output=execSync(command,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim();return output.length>0?output:null}catch{return null}}function resolveCommitSha(){return readFirstEnvValue(process.env,releaseSourceIdEnvKeys)??runGitCommand(`git rev-parse HEAD`)}function resolveReleaseSlug(){let commitSha=resolveCommitSha();return{commitSha,slug:commitSha?deriveReleaseSlug(commitSha):null}}export{resolveCommitSha,resolveReleaseSlug};
|
|
2
|
-
//# sourceMappingURL=release-slug.mjs.map
|
|
1
|
+
import{readFirstEnvValue}from"@interfere/types/sdk/env";import{deriveReleaseSlug}from"@interfere/types/releases/slug";import{releaseSourceIdEnvKeys}from"@interfere/types/integrations";import{execSync}from"node:child_process";function runGitCommand(command){try{let output=execSync(command,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim();return output.length>0?output:null}catch{return null}}function resolveCommitSha(){return readFirstEnvValue(process.env,releaseSourceIdEnvKeys)??runGitCommand(`git rev-parse HEAD`)}function resolveReleaseSlug(){let commitSha=resolveCommitSha();return{commitSha,slug:commitSha?deriveReleaseSlug(commitSha):null}}export{resolveCommitSha,resolveReleaseSlug};
|
package/dist/internal/url.d.cts
CHANGED
package/dist/internal/url.d.mts
CHANGED
package/dist/internal/url.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function withPublicKey(url,publicKey){let next=new URL(url);return next.searchParams.set(`pk`,publicKey),next.toString()}export{withPublicKey};
|
|
2
|
-
//# sourceMappingURL=url.mjs.map
|
|
1
|
+
function withPublicKey(url,publicKey){let next=new URL(url);return next.searchParams.set(`pk`,publicKey),next.toString()}export{withPublicKey};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{name,version}from"../package.mjs";const PRODUCER_VERSION=`${name}@${version}`;export{PRODUCER_VERSION};
|
|
2
|
-
//# sourceMappingURL=version.mjs.map
|
|
1
|
+
import{name,version}from"../package.mjs";const PRODUCER_VERSION=`${name}@${version}`;export{PRODUCER_VERSION};
|
package/dist/package.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"name",{enumerable:!0,get:function(){return`@interfere/node`}}),Object.defineProperty(exports,"version",{enumerable:!0,get:function(){return`0.1.0-canary.7`}});
|
package/dist/package.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
var name=`@interfere/node`,version=`0.1.0-canary.
|
|
2
|
-
//# sourceMappingURL=package.mjs.map
|
|
1
|
+
var name=`@interfere/node`,version=`0.1.0-canary.7`;export{name,version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interfere/node",
|
|
3
|
-
"version": "0.1.0-canary.
|
|
3
|
+
"version": "0.1.0-canary.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node.js SDK for Interfere. Error tracking and OTel instrumentation for any Node server.",
|
|
6
6
|
"keywords": [
|
|
@@ -77,22 +77,21 @@
|
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@interfere/constants": "^9.0.2-canary.0",
|
|
80
|
-
"@interfere/types": "^9.0.3-canary.
|
|
80
|
+
"@interfere/types": "^9.0.3-canary.2",
|
|
81
81
|
"@opentelemetry/api": "^1.9.1",
|
|
82
82
|
"@opentelemetry/context-async-hooks": "^2.7.1",
|
|
83
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.
|
|
83
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.219.0",
|
|
84
84
|
"@opentelemetry/resources": "^2.7.0",
|
|
85
85
|
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
86
|
-
"@opentelemetry/sdk-trace-node": "^2.7.1"
|
|
87
|
-
"uuid": "^14.0.0"
|
|
86
|
+
"@opentelemetry/sdk-trace-node": "^2.7.1"
|
|
88
87
|
},
|
|
89
88
|
"devDependencies": {
|
|
90
89
|
"@interfere/test-utils": "^9.0.0",
|
|
91
90
|
"@interfere/typescript-config": "^9.0.0",
|
|
92
|
-
"@types/node": "^
|
|
93
|
-
"@vitest/coverage-v8": "4.1.
|
|
94
|
-
"tsdown": "0.22.
|
|
91
|
+
"@types/node": "^26.0.0",
|
|
92
|
+
"@vitest/coverage-v8": "4.1.9",
|
|
93
|
+
"tsdown": "^0.22.2",
|
|
95
94
|
"typescript": "^6.0.3",
|
|
96
|
-
"vitest": "4.1.
|
|
95
|
+
"vitest": "4.1.9"
|
|
97
96
|
}
|
|
98
97
|
}
|