@foam-ai/node-cliengo 0.1.0-alpha.16 → 0.1.0-alpha.18

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.
@@ -110,8 +110,14 @@ function createInertInstance(serviceName) {
110
110
  buildTraceparent: trace_bridge_1.buildTraceparent,
111
111
  injectSnsAttributes: sns_1.injectSnsAttributes,
112
112
  injectJobData: job_1.injectJobData,
113
- wrapSqsConsumer: async (_s, _m, fn) => fn(),
114
- wrapJobConsumer: async (_s, _j, fn) => fn(),
113
+ wrapSqsConsumer: async (...args) => {
114
+ const fn = typeof args[0] === 'string' ? args[2] : args[3];
115
+ return fn();
116
+ },
117
+ wrapJobConsumer: async (...args) => {
118
+ const fn = typeof args[0] === 'string' ? args[2] : args[3];
119
+ return fn();
120
+ },
115
121
  extractParentContext: () => {
116
122
  const { ROOT_CONTEXT } = require('@opentelemetry/api');
117
123
  return ROOT_CONTEXT;
@@ -381,8 +387,18 @@ function init(serviceName, options = {}) {
381
387
  buildTraceparent: trace_bridge_1.buildTraceparent,
382
388
  injectSnsAttributes: sns_1.injectSnsAttributes,
383
389
  injectJobData: job_1.injectJobData,
384
- wrapSqsConsumer: (s, m, fn) => (0, sqs_1.wrapSqsConsumer)(tracer, s, m, fn, metrics),
385
- wrapJobConsumer: (s, j, fn) => (0, job_1.wrapJobConsumer)(tracer, s, j, fn, metrics),
390
+ wrapSqsConsumer: (...args) => {
391
+ if (typeof args[0] === 'string') {
392
+ return (0, sqs_1.wrapSqsConsumer)(tracer, args[0], args[1], args[2], metrics);
393
+ }
394
+ return (0, sqs_1.wrapSqsConsumer)(tracer, args[1], args[2], args[3], metrics);
395
+ },
396
+ wrapJobConsumer: (...args) => {
397
+ if (typeof args[0] === 'string') {
398
+ return (0, job_1.wrapJobConsumer)(tracer, args[0], args[1], args[2], metrics);
399
+ }
400
+ return (0, job_1.wrapJobConsumer)(tracer, args[1], args[2], args[3], metrics);
401
+ },
386
402
  extractParentContext: trace_bridge_1.extractParentContext,
387
403
  shutdown,
388
404
  };
@@ -96,7 +96,11 @@ export interface FoamInstance {
96
96
  injectJobData<T extends Record<string, unknown>>(data: T): T & {
97
97
  traceparent: string;
98
98
  };
99
+ /** @deprecated Pass (spanName, msg, fn) — the tracer arg is no longer needed. */
100
+ wrapSqsConsumer(tracer: Tracer, spanName: string, msg: SqsMessage, fn: () => Promise<void>): Promise<void>;
99
101
  wrapSqsConsumer(spanName: string, msg: SqsMessage, fn: () => Promise<void>): Promise<void>;
102
+ /** @deprecated Pass (spanName, jobData, fn) — the tracer arg is no longer needed. */
103
+ wrapJobConsumer(tracer: Tracer, spanName: string, jobData: Record<string, unknown>, fn: () => Promise<void>): Promise<void>;
100
104
  wrapJobConsumer(spanName: string, jobData: Record<string, unknown>, fn: () => Promise<void>): Promise<void>;
101
105
  extractParentContext(traceparent: string): Context;
102
106
  shutdown(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foam-ai/node-cliengo",
3
- "version": "0.1.0-alpha.16",
3
+ "version": "0.1.0-alpha.18",
4
4
  "description": "Unified observability (traces, logs, metrics) for Cliengo Node.js services, connecting New Relic APM with Foam's OTel collector.",
5
5
  "main": "dist/node-cliengo/src/index.js",
6
6
  "types": "dist/node-cliengo/src/index.d.ts",