@sailfish-ai/sf-veritas 0.2.5 → 0.2.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.
@@ -13,6 +13,7 @@
13
13
  * 6. Environment variables SF_FUNCSPAN_*
14
14
  * 7. Hard-coded defaults
15
15
  */
16
+ import { AsyncLocalStorage } from "async_hooks";
16
17
  export interface FuncspanConfig {
17
18
  /** Capture function input arguments */
18
19
  capture_arguments: boolean;
@@ -57,8 +58,14 @@ export declare function getDefaultConfig(): FuncspanConfig;
57
58
  * Example: "1-1-10-10-1-1.0-1-0-0"
58
59
  */
59
60
  export declare function parseHeaderOverride(header: string): FuncspanHeaderOverride | null;
61
+ /**
62
+ * AsyncLocalStorage for per-request funcspan override
63
+ * Exported to allow direct .run() usage in patchhttpInbound.ts
64
+ */
65
+ export declare const funcspanOverrideStorage: AsyncLocalStorage<string>;
60
66
  /**
61
67
  * Set funcspan override from HTTP header (per-request)
68
+ * @deprecated Use funcspanOverrideStorage.run() directly instead for proper async context propagation
62
69
  */
63
70
  export declare function setFuncspanOverride(headerValue: string): void;
64
71
  /**
@@ -67,6 +74,7 @@ export declare function setFuncspanOverride(headerValue: string): void;
67
74
  export declare function getFuncspanOverride(): string | undefined;
68
75
  /**
69
76
  * Clear funcspan override (usually at end of request)
77
+ * @deprecated No longer needed - context is automatically cleared when .run() callback completes
70
78
  */
71
79
  export declare function clearFuncspanOverride(): void;
72
80
  /**
@@ -1,5 +1,5 @@
1
1
  export { ContextManager, runWithContext, getCurrentFunctionSpanId } from "./contextManager";
2
- export { addOrUpdateMetadata, identify, setupInterceptors } from "./unifiedInterceptor";
2
+ export { addOrUpdateMetadata, identify, setupInterceptors, isSetupInterceptorsInitialized } from "./unifiedInterceptor";
3
3
  export { captureFunctionSpan, type FunctionSpanMetadata } from "./funcSpanCapture";
4
4
  export { type FuncspanConfig, type FuncspanHeaderOverride, setFuncspanOverride, getFuncspanOverride, clearFuncspanOverride, parseHeaderOverride, getEnvConfig, getDefaultConfig, } from "./funcSpanConfig";
5
5
  export { initializeConfigLoader, getGlobalConfig, isConfigLoaderInitialized, } from "./funcSpanConfigLoader";
@@ -20,6 +20,26 @@ export interface FuncspanWebpackPluginOptions extends Omit<TransformOptions, "pr
20
20
  * Enable the plugin (default: true)
21
21
  */
22
22
  enabled?: boolean;
23
+ /**
24
+ * Enable worker pool tracking (default: false)
25
+ */
26
+ enableWorkerPoolTracking?: boolean;
27
+ /**
28
+ * Track DNS operations (default: false)
29
+ */
30
+ workerPoolTrackDns?: boolean;
31
+ /**
32
+ * Track File System operations (default: false)
33
+ */
34
+ workerPoolTrackFs?: boolean;
35
+ /**
36
+ * Track Crypto operations (default: false)
37
+ */
38
+ workerPoolTrackCrypto?: boolean;
39
+ /**
40
+ * Track Zlib operations (default: false)
41
+ */
42
+ workerPoolTrackZlib?: boolean;
23
43
  }
24
44
  /**
25
45
  * Webpack plugin for automatic function span instrumentation
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Worker Pool AST Transformer
3
+ *
4
+ * Transforms JavaScript/TypeScript code to wrap DNS/fs/crypto/zlib calls
5
+ * with captureWorkerPoolOperation() for automatic instrumentation at build time.
6
+ */
7
+ export interface WorkerPoolTransformOptions {
8
+ /**
9
+ * Project root directory for resolving relative paths
10
+ */
11
+ projectRoot?: string;
12
+ /**
13
+ * Track DNS operations
14
+ */
15
+ trackDns?: boolean;
16
+ /**
17
+ * Track File System operations
18
+ */
19
+ trackFs?: boolean;
20
+ /**
21
+ * Track Crypto operations
22
+ */
23
+ trackCrypto?: boolean;
24
+ /**
25
+ * Track Zlib operations
26
+ */
27
+ trackZlib?: boolean;
28
+ /**
29
+ * Enable debug logging
30
+ */
31
+ debug?: boolean;
32
+ }
33
+ export interface TransformResult {
34
+ code: string;
35
+ map?: any;
36
+ modified: boolean;
37
+ callsWrapped: number;
38
+ }
39
+ /**
40
+ * Transform JavaScript/TypeScript source code to wrap worker pool calls
41
+ */
42
+ export declare function transformWorkerPoolCalls(source: string, filePath: string, options?: WorkerPoolTransformOptions): Promise<TransformResult>;
@@ -7,6 +7,10 @@ import { Traits } from "./utils";
7
7
  * configuration variables, and sets up log, exception, and metadata interceptors.
8
8
  */
9
9
  export declare function setupInterceptors(options: SetupOptions): void;
10
+ /**
11
+ * Check if setupInterceptors has been initialized
12
+ */
13
+ export declare function isSetupInterceptorsInitialized(): boolean;
10
14
  /**
11
15
  * Identifies a user and optionally updates their metadata.
12
16
  *
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Worker Pool Capture Export
3
+ *
4
+ * Re-exports captureWorkerPoolOperation for build-time instrumented code.
5
+ * This allows transformed code to import the capture function directly:
6
+ *
7
+ * const { captureWorkerPoolOperation } = require('@sailfish-ai/sf-veritas/worker-pool-capture');
8
+ */
9
+ export { captureWorkerPoolOperation } from './workerPoolSpanCapture';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./workerPoolSpanCapture-DEwlTq0a.cjs");exports.captureWorkerPoolOperation=e.captureWorkerPoolOperation;
@@ -0,0 +1,4 @@
1
+ import { c as e } from "./workerPoolSpanCapture-D0-0Z0Jw.js";
2
+ export {
3
+ e as captureWorkerPoolOperation
4
+ };