MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / get

Function get

packages/core/src/tracing/anthropic-ai/index.ts:327–352  ·  view source on GitHub ↗
(obj: object, prop: string)

Source from the content-addressed store, hash-verified

325function createDeepProxy<T extends object>(target: T, currentPath = '', options: AnthropicAiOptions): T {
326 return new Proxy(target, {
327 get(obj: object, prop: string): unknown {
328 const value = (obj as Record<string, unknown>)[prop];
329 const methodPath = buildMethodPath(currentPath, String(prop));
330
331 const instrumentedMethod = ANTHROPIC_METHOD_REGISTRY[methodPath as keyof typeof ANTHROPIC_METHOD_REGISTRY];
332 if (typeof value === 'function' && instrumentedMethod) {
333 return instrumentMethod(
334 value as (...args: unknown[]) => unknown | Promise<unknown>,
335 methodPath,
336 instrumentedMethod,
337 obj,
338 options,
339 );
340 }
341
342 if (typeof value === 'function') {
343 // Bind non-instrumented functions to preserve the original `this` context,
344 return value.bind(obj);
345 }
346
347 if (value && typeof value === 'object') {
348 return createDeepProxy(value, methodPath, options);
349 }
350
351 return value;
352 },
353 }) as T;
354}
355

Callers

nothing calls this directly

Calls 4

buildMethodPathFunction · 0.90
bindMethod · 0.80
instrumentMethodFunction · 0.70
createDeepProxyFunction · 0.70

Tested by

no test coverage detected