@treatwell/moleculer-essentials 2.1.1-beta.1 → 2.1.1

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
@@ -14,6 +14,7 @@
14
14
  - [Basic Example](#basic-example)
15
15
  - [Mixins](#mixins)
16
16
  - [License](#license)
17
+
17
18
  <!-- TOC -->
18
19
 
19
20
  > [!WARNING]
@@ -216,25 +216,29 @@ function zodToOpenAPISchema(schema, extractor) {
216
216
  }
217
217
  return res;
218
218
  }
219
- const zodDate = z.transform((val) => {
220
- if (typeof val === "string") {
221
- const date = parseISO(val);
222
- if (!Number.isNaN(date.getTime())) {
223
- return date;
219
+ const zodDate = z.nonoptional(
220
+ z.transform((val) => {
221
+ if (typeof val === "string") {
222
+ const date = parseISO(val);
223
+ if (!Number.isNaN(date.getTime())) {
224
+ return date;
225
+ }
224
226
  }
225
- }
226
- return val;
227
- }).pipe(z.date());
227
+ return val;
228
+ }).pipe(z.date())
229
+ );
228
230
  const OBJECT_ID_PATTERN = /^[a-f\d]{24}$/i;
229
231
  function isObjectId(val) {
230
232
  return val instanceof ObjectId;
231
233
  }
232
- const zodObjectId = z.transform((val) => {
233
- if (typeof val === "string" && OBJECT_ID_PATTERN.test(val)) {
234
- return new ObjectId(val);
235
- }
236
- return val;
237
- }).pipe(z.custom(isObjectId, { abort: true })).meta({ id: "ObjectId" });
234
+ const zodObjectId = z.nonoptional(
235
+ z.transform((val) => {
236
+ if (typeof val === "string" && OBJECT_ID_PATTERN.test(val)) {
237
+ return new ObjectId(val);
238
+ }
239
+ return val;
240
+ }).pipe(z.custom(isObjectId, { abort: true })).meta({ id: "ObjectId" })
241
+ );
238
242
  function zodCoerceArray(element, params) {
239
243
  return z.transform((val) => !Array.isArray(val) && val !== void 0 ? [val] : val).pipe(z.array(element, params));
240
244
  }
@@ -218,25 +218,29 @@ function zodToOpenAPISchema(schema, extractor) {
218
218
  }
219
219
  return res;
220
220
  }
221
- const zodDate = v4.z.transform((val) => {
222
- if (typeof val === "string") {
223
- const date = dateFns.parseISO(val);
224
- if (!Number.isNaN(date.getTime())) {
225
- return date;
221
+ const zodDate = v4.z.nonoptional(
222
+ v4.z.transform((val) => {
223
+ if (typeof val === "string") {
224
+ const date = dateFns.parseISO(val);
225
+ if (!Number.isNaN(date.getTime())) {
226
+ return date;
227
+ }
226
228
  }
227
- }
228
- return val;
229
- }).pipe(v4.z.date());
229
+ return val;
230
+ }).pipe(v4.z.date())
231
+ );
230
232
  const OBJECT_ID_PATTERN = /^[a-f\d]{24}$/i;
231
233
  function isObjectId(val) {
232
234
  return val instanceof bson.ObjectId;
233
235
  }
234
- const zodObjectId = v4.z.transform((val) => {
235
- if (typeof val === "string" && OBJECT_ID_PATTERN.test(val)) {
236
- return new bson.ObjectId(val);
237
- }
238
- return val;
239
- }).pipe(v4.z.custom(isObjectId, { abort: true })).meta({ id: "ObjectId" });
236
+ const zodObjectId = v4.z.nonoptional(
237
+ v4.z.transform((val) => {
238
+ if (typeof val === "string" && OBJECT_ID_PATTERN.test(val)) {
239
+ return new bson.ObjectId(val);
240
+ }
241
+ return val;
242
+ }).pipe(v4.z.custom(isObjectId, { abort: true })).meta({ id: "ObjectId" })
243
+ );
240
244
  function zodCoerceArray(element, params) {
241
245
  return v4.z.transform((val) => !Array.isArray(val) && val !== void 0 ? [val] : val).pipe(v4.z.array(element, params));
242
246
  }
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-lmnhNH-8.cjs');
3
+ var index = require('./index-CbFCa8NT.cjs');
4
4
  var _2019_js = require('ajv/dist/2019.js');
5
5
  var moleculer = require('moleculer');
6
6
  var addFormats = require('ajv-formats');
@@ -1380,7 +1380,6 @@ function flattenTags(obj, convertToString = false, path = "") {
1380
1380
 
1381
1381
  const gzipPromise = node_util.promisify(node_zlib.gzip);
1382
1382
  class NewrelicTraceExporter extends moleculer.TracerExporters.Base {
1383
- opts = {};
1384
1383
  queue;
1385
1384
  timer = null;
1386
1385
  defaultTags = {};
@@ -1497,7 +1496,6 @@ class NewrelicTraceExporter extends moleculer.TracerExporters.Base {
1497
1496
  }
1498
1497
 
1499
1498
  class NewrelicMetricsReporter extends moleculer.MetricReporters.Base {
1500
- opts = {};
1501
1499
  timer = null;
1502
1500
  defaultTags = {};
1503
1501
  constructor(opts) {
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { S as SomeJSONSchema, J as JSONSchemaType, C as CustomActionSchema, A as Alias, P as PartialCustomServiceSchema, D as Document, a as SchemaObject, O as OperationObject, R as ReferenceObject, b as CustomServiceSchema, c as CreateLoggerOptions, M as MoleculerLoggerConfigOptions } from './types-Cdh7thEZ.cjs';
2
- export { d as AjvValidator, e as ApiKeySecurityScheme, f as CallbackObject, g as ComponentsObject, h as ContactObject, i as ContextFactory, E as EncodingObject, j as ExampleObject, k as ExternalDocumentationObject, H as HeaderObject, l as HttpSecurityScheme, I as InfoObject, m as InternalCallbackServiceThis, n as InternalObjectServiceThis, L as LicenseObject, o as LinkObject, p as MediaTypeObject, q as OAuth2SecurityScheme, r as OpenIdSecurityScheme, s as ParameterBaseObject, t as ParameterObject, u as PathItemObject, v as PathsObject, w as PropertiesSchema, x as RequestBodyObject, y as RequiredMembers, z as ResponseObject, B as ResponsesObject, F as SecurityRequirementObject, G as SecuritySchemeObject, K as ServerObject, N as ServerVariableObject, T as TagObject, Q as Transform, U as TransformField, V as TransformLevel, W as TransformMap, X as Transformer, Y as ValidationSchema, Z as ZodValidator } from './types-Cdh7thEZ.cjs';
1
+ import { S as SomeJSONSchema, J as JSONSchemaType, C as CustomActionSchema, A as Alias, P as PartialCustomServiceSchema, D as Document, a as SchemaObject, O as OperationObject, R as ReferenceObject, b as CustomServiceSchema, c as CreateLoggerOptions, M as MoleculerLoggerConfigOptions } from './newrelic-metrics-reporter-CmRMT4LG.cjs';
2
+ export { d as AjvValidator, e as ApiKeySecurityScheme, f as CallbackObject, g as ComponentsObject, h as ContactObject, i as ContextFactory, E as EncodingObject, j as ExampleObject, k as ExternalDocumentationObject, H as HeaderObject, l as HttpSecurityScheme, I as InfoObject, m as InternalCallbackServiceThis, n as InternalObjectServiceThis, L as LicenseObject, o as LinkObject, p as MediaTypeObject, N as NewrelicMetricsReporter, q as NewrelicTraceExporter, r as OAuth2SecurityScheme, s as OpenIdSecurityScheme, t as ParameterBaseObject, u as ParameterObject, v as PathItemObject, w as PathsObject, x as PropertiesSchema, y as RequestBodyObject, z as RequiredMembers, B as ResponseObject, F as ResponsesObject, G as SecurityRequirementObject, K as SecuritySchemeObject, Q as ServerObject, T as ServerVariableObject, U as TagObject, V as Transform, W as TransformField, X as TransformLevel, Y as TransformMap, Z as Transformer, _ as ValidationSchema, $ as ZodValidator } from './newrelic-metrics-reporter-CmRMT4LG.cjs';
3
3
  import { ObjectId } from 'bson';
4
4
  import { z, ZodType } from 'zod/v4';
5
5
  import { Ajv2019 } from 'ajv/dist/2019.js';
6
- import { Errors, Context, ServiceSettingSchema, ServiceSchema, Service, ServiceBroker, BrokerOptions, Middleware, LoggerConfig, TracerExporters, Logger as Logger$1, Tracer, Span, MetricReporters, MetricRegistry } from 'moleculer';
6
+ import { Errors, Context, ServiceSettingSchema, ServiceSchema, Service, ServiceBroker, BrokerOptions, Middleware, LoggerConfig } from 'moleculer';
7
7
  import { Logger } from 'pino';
8
8
  import 'pino-pretty';
9
9
 
@@ -173,8 +173,8 @@ declare function createOpenAPIResponses(model: OpenAPIResponses, description?: s
173
173
  * For this, you should use helpers provided by this package.
174
174
  */
175
175
  declare function zodToOpenAPISchema(schema: ZodType, extractor: OpenAPIExtractor): SchemaObject | ReferenceObject;
176
- declare const zodDate: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDate>;
177
- declare const zodObjectId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodCustom<ObjectId, ObjectId>>;
176
+ declare const zodDate: z.ZodNonOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDate>>;
177
+ declare const zodObjectId: z.ZodNonOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodCustom<ObjectId, ObjectId>>>;
178
178
  declare function zodCoerceArray<T extends ZodType>(element: T, params?: Parameters<typeof z.array>[1]): z.ZodPipe<z.ZodTransform<any[] | undefined, unknown>, z.ZodArray<T>>;
179
179
  declare function isZodSchema<S extends z.ZodType>(schema: unknown, type?: S['type']): schema is S;
180
180
 
@@ -275,116 +275,5 @@ declare function createLogger(opts?: CreateLoggerOptions): Logger;
275
275
  */
276
276
  declare function createLoggerConfig(opts?: MoleculerLoggerConfigOptions): LoggerConfig;
277
277
 
278
- type NewrelicTraceExporterOptions = {
279
- logger?: Logger$1;
280
- safetyTags?: boolean;
281
- /**
282
- * Base URL for NewRelic server.
283
- */
284
- baseURL?: string;
285
- /**
286
- * Maximum number of spans to be sent in one time.
287
- */
288
- batchSize?: number;
289
- /**
290
- * NewRelic Insert API Key.
291
- */
292
- insertKey?: string;
293
- /**
294
- * Batch send time interval in seconds.
295
- */
296
- interval?: number;
297
- /**
298
- * Default span tags.
299
- */
300
- defaultTags?: Record<string, unknown> | ((tracer?: unknown) => Record<string, unknown>);
301
- };
302
- /**
303
- * >>> Hard copy of the moleculer NewRelic provider. It didn't handle errors correctly
304
- *
305
- * Trace Exporter for NewRelic using Zipkin data.
306
- *
307
- * NewRelic zipkin tracer: https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/trace-api/report-zipkin-format-traces-trace-api
308
- * API v2: https://zipkin.io/zipkin-api/#/
309
- */
310
- declare class NewrelicTraceExporter extends TracerExporters.Base {
311
- private readonly opts;
312
- private queue;
313
- private timer;
314
- private defaultTags;
315
- constructor(opts: NewrelicTraceExporterOptions);
316
- /**
317
- * Initialize Trace Exporter.
318
- */
319
- init(tracer: Tracer): void;
320
- /**
321
- * Stop Trace exporter
322
- */
323
- stop(): Promise<void>;
324
- /**
325
- * Span is finished.
326
- */
327
- spanFinished(span: Span): void;
328
- /**
329
- * Flush tracing data to NewRelic Zipkin api endpoint
330
- */
331
- flush(): Promise<void>;
332
- /**
333
- * Generate tracing data for NewRelic
334
- */
335
- generateTracingData(): unknown[];
336
- /**
337
- * Create NewRelic v1 payload
338
- */
339
- makePayload(span: Span): unknown;
340
- }
341
-
342
- type DefaultTags = Record<string, unknown> | ((registry: MetricRegistry) => Record<string, unknown>);
343
- type NewrelicMetricsOptions = MetricReporters.Base.MetricReporterOptions & {
344
- /**
345
- * Base URL for NewRelic server.
346
- */
347
- baseURL?: string;
348
- /**
349
- * NewRelic Insert API Key
350
- */
351
- insertKey?: string;
352
- /**
353
- * Batch send time interval in seconds.
354
- */
355
- interval?: number;
356
- /**
357
- * Default tags to be added to all metrics.
358
- */
359
- defaultTags?: DefaultTags;
360
- };
361
- /**
362
- * NewRelic metrics reporter.
363
- *
364
- * NewRelic API: https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/metric-data-type/
365
- */
366
- declare class NewrelicMetricsReporter extends MetricReporters.Base {
367
- private readonly opts;
368
- private timer;
369
- private defaultTags;
370
- constructor(opts: NewrelicMetricsOptions);
371
- /**
372
- * Initialize Trace Exporter.
373
- */
374
- init(registry: MetricRegistry): void;
375
- /**
376
- * Stop Trace exporter
377
- */
378
- stop(): Promise<void>;
379
- /**
380
- * Flush tracing data to NewRelic Zipkin api endpoint
381
- */
382
- flush(): Promise<void>;
383
- /**
384
- * Generate metrics data for NewRelic
385
- */
386
- generateMetricsPayload(): unknown[];
387
- }
388
-
389
- export { AjvExtractor, Alias, COERCE_ARRAY_ATTRIBUTE, CustomActionSchema, CustomServiceSchema, DATE_TYPE, Document, EMPTY_OBJECT_SCHEMA, HealthCheckMiddleware, JSONSchemaType, NewrelicMetricsReporter, NewrelicTraceExporter, OBJECTID_TYPE, OpenAPIExtractor, OpenAPIMixin, OperationObject, PartialCustomServiceSchema, RefExtractor, ReferenceObject, SCHEMA_REF_NAME, SchemaObject, ServiceFactory, SomeJSONSchema, addFieldsToSchema, composeSchemas, createLogger, createLoggerConfig, createOpenAPIResponses, createServiceBroker, getMetadataFromService, isServiceSelected, isZodSchema, omitFields, optionalExceptFields, optionalFields, pickFields, toPartialSchema, wrapMixin, wrapService, zodCoerceArray, zodDate, zodObjectId, zodToOpenAPISchema };
278
+ export { AjvExtractor, Alias, COERCE_ARRAY_ATTRIBUTE, CustomActionSchema, CustomServiceSchema, DATE_TYPE, Document, EMPTY_OBJECT_SCHEMA, HealthCheckMiddleware, JSONSchemaType, OBJECTID_TYPE, OpenAPIExtractor, OpenAPIMixin, OperationObject, PartialCustomServiceSchema, RefExtractor, ReferenceObject, SCHEMA_REF_NAME, SchemaObject, ServiceFactory, SomeJSONSchema, addFieldsToSchema, composeSchemas, createLogger, createLoggerConfig, createOpenAPIResponses, createServiceBroker, getMetadataFromService, isServiceSelected, isZodSchema, omitFields, optionalExceptFields, optionalFields, pickFields, toPartialSchema, wrapMixin, wrapService, zodCoerceArray, zodDate, zodObjectId, zodToOpenAPISchema };
390
279
  export type { OpenAPIMixinOptions, OpenAPIResponses, Selector, _InferredServiceSchema };
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- import { S as SomeJSONSchema, J as JSONSchemaType, C as CustomActionSchema, A as Alias, P as PartialCustomServiceSchema, D as Document, a as SchemaObject, O as OperationObject, R as ReferenceObject, b as CustomServiceSchema, c as CreateLoggerOptions, M as MoleculerLoggerConfigOptions } from './types-Cdh7thEZ.mjs';
2
- export { d as AjvValidator, e as ApiKeySecurityScheme, f as CallbackObject, g as ComponentsObject, h as ContactObject, i as ContextFactory, E as EncodingObject, j as ExampleObject, k as ExternalDocumentationObject, H as HeaderObject, l as HttpSecurityScheme, I as InfoObject, m as InternalCallbackServiceThis, n as InternalObjectServiceThis, L as LicenseObject, o as LinkObject, p as MediaTypeObject, q as OAuth2SecurityScheme, r as OpenIdSecurityScheme, s as ParameterBaseObject, t as ParameterObject, u as PathItemObject, v as PathsObject, w as PropertiesSchema, x as RequestBodyObject, y as RequiredMembers, z as ResponseObject, B as ResponsesObject, F as SecurityRequirementObject, G as SecuritySchemeObject, K as ServerObject, N as ServerVariableObject, T as TagObject, Q as Transform, U as TransformField, V as TransformLevel, W as TransformMap, X as Transformer, Y as ValidationSchema, Z as ZodValidator } from './types-Cdh7thEZ.mjs';
1
+ import { S as SomeJSONSchema, J as JSONSchemaType, C as CustomActionSchema, A as Alias, P as PartialCustomServiceSchema, D as Document, a as SchemaObject, O as OperationObject, R as ReferenceObject, b as CustomServiceSchema, c as CreateLoggerOptions, M as MoleculerLoggerConfigOptions } from './newrelic-metrics-reporter-CmRMT4LG.mjs';
2
+ export { d as AjvValidator, e as ApiKeySecurityScheme, f as CallbackObject, g as ComponentsObject, h as ContactObject, i as ContextFactory, E as EncodingObject, j as ExampleObject, k as ExternalDocumentationObject, H as HeaderObject, l as HttpSecurityScheme, I as InfoObject, m as InternalCallbackServiceThis, n as InternalObjectServiceThis, L as LicenseObject, o as LinkObject, p as MediaTypeObject, N as NewrelicMetricsReporter, q as NewrelicTraceExporter, r as OAuth2SecurityScheme, s as OpenIdSecurityScheme, t as ParameterBaseObject, u as ParameterObject, v as PathItemObject, w as PathsObject, x as PropertiesSchema, y as RequestBodyObject, z as RequiredMembers, B as ResponseObject, F as ResponsesObject, G as SecurityRequirementObject, K as SecuritySchemeObject, Q as ServerObject, T as ServerVariableObject, U as TagObject, V as Transform, W as TransformField, X as TransformLevel, Y as TransformMap, Z as Transformer, _ as ValidationSchema, $ as ZodValidator } from './newrelic-metrics-reporter-CmRMT4LG.mjs';
3
3
  import { ObjectId } from 'bson';
4
4
  import { z, ZodType } from 'zod/v4';
5
5
  import { Ajv2019 } from 'ajv/dist/2019.js';
6
- import { Errors, Context, ServiceSettingSchema, ServiceSchema, Service, ServiceBroker, BrokerOptions, Middleware, LoggerConfig, TracerExporters, Logger as Logger$1, Tracer, Span, MetricReporters, MetricRegistry } from 'moleculer';
6
+ import { Errors, Context, ServiceSettingSchema, ServiceSchema, Service, ServiceBroker, BrokerOptions, Middleware, LoggerConfig } from 'moleculer';
7
7
  import { Logger } from 'pino';
8
8
  import 'pino-pretty';
9
9
 
@@ -173,8 +173,8 @@ declare function createOpenAPIResponses(model: OpenAPIResponses, description?: s
173
173
  * For this, you should use helpers provided by this package.
174
174
  */
175
175
  declare function zodToOpenAPISchema(schema: ZodType, extractor: OpenAPIExtractor): SchemaObject | ReferenceObject;
176
- declare const zodDate: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDate>;
177
- declare const zodObjectId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodCustom<ObjectId, ObjectId>>;
176
+ declare const zodDate: z.ZodNonOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDate>>;
177
+ declare const zodObjectId: z.ZodNonOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodCustom<ObjectId, ObjectId>>>;
178
178
  declare function zodCoerceArray<T extends ZodType>(element: T, params?: Parameters<typeof z.array>[1]): z.ZodPipe<z.ZodTransform<any[] | undefined, unknown>, z.ZodArray<T>>;
179
179
  declare function isZodSchema<S extends z.ZodType>(schema: unknown, type?: S['type']): schema is S;
180
180
 
@@ -275,116 +275,5 @@ declare function createLogger(opts?: CreateLoggerOptions): Logger;
275
275
  */
276
276
  declare function createLoggerConfig(opts?: MoleculerLoggerConfigOptions): LoggerConfig;
277
277
 
278
- type NewrelicTraceExporterOptions = {
279
- logger?: Logger$1;
280
- safetyTags?: boolean;
281
- /**
282
- * Base URL for NewRelic server.
283
- */
284
- baseURL?: string;
285
- /**
286
- * Maximum number of spans to be sent in one time.
287
- */
288
- batchSize?: number;
289
- /**
290
- * NewRelic Insert API Key.
291
- */
292
- insertKey?: string;
293
- /**
294
- * Batch send time interval in seconds.
295
- */
296
- interval?: number;
297
- /**
298
- * Default span tags.
299
- */
300
- defaultTags?: Record<string, unknown> | ((tracer?: unknown) => Record<string, unknown>);
301
- };
302
- /**
303
- * >>> Hard copy of the moleculer NewRelic provider. It didn't handle errors correctly
304
- *
305
- * Trace Exporter for NewRelic using Zipkin data.
306
- *
307
- * NewRelic zipkin tracer: https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/trace-api/report-zipkin-format-traces-trace-api
308
- * API v2: https://zipkin.io/zipkin-api/#/
309
- */
310
- declare class NewrelicTraceExporter extends TracerExporters.Base {
311
- private readonly opts;
312
- private queue;
313
- private timer;
314
- private defaultTags;
315
- constructor(opts: NewrelicTraceExporterOptions);
316
- /**
317
- * Initialize Trace Exporter.
318
- */
319
- init(tracer: Tracer): void;
320
- /**
321
- * Stop Trace exporter
322
- */
323
- stop(): Promise<void>;
324
- /**
325
- * Span is finished.
326
- */
327
- spanFinished(span: Span): void;
328
- /**
329
- * Flush tracing data to NewRelic Zipkin api endpoint
330
- */
331
- flush(): Promise<void>;
332
- /**
333
- * Generate tracing data for NewRelic
334
- */
335
- generateTracingData(): unknown[];
336
- /**
337
- * Create NewRelic v1 payload
338
- */
339
- makePayload(span: Span): unknown;
340
- }
341
-
342
- type DefaultTags = Record<string, unknown> | ((registry: MetricRegistry) => Record<string, unknown>);
343
- type NewrelicMetricsOptions = MetricReporters.Base.MetricReporterOptions & {
344
- /**
345
- * Base URL for NewRelic server.
346
- */
347
- baseURL?: string;
348
- /**
349
- * NewRelic Insert API Key
350
- */
351
- insertKey?: string;
352
- /**
353
- * Batch send time interval in seconds.
354
- */
355
- interval?: number;
356
- /**
357
- * Default tags to be added to all metrics.
358
- */
359
- defaultTags?: DefaultTags;
360
- };
361
- /**
362
- * NewRelic metrics reporter.
363
- *
364
- * NewRelic API: https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/metric-data-type/
365
- */
366
- declare class NewrelicMetricsReporter extends MetricReporters.Base {
367
- private readonly opts;
368
- private timer;
369
- private defaultTags;
370
- constructor(opts: NewrelicMetricsOptions);
371
- /**
372
- * Initialize Trace Exporter.
373
- */
374
- init(registry: MetricRegistry): void;
375
- /**
376
- * Stop Trace exporter
377
- */
378
- stop(): Promise<void>;
379
- /**
380
- * Flush tracing data to NewRelic Zipkin api endpoint
381
- */
382
- flush(): Promise<void>;
383
- /**
384
- * Generate metrics data for NewRelic
385
- */
386
- generateMetricsPayload(): unknown[];
387
- }
388
-
389
- export { AjvExtractor, Alias, COERCE_ARRAY_ATTRIBUTE, CustomActionSchema, CustomServiceSchema, DATE_TYPE, Document, EMPTY_OBJECT_SCHEMA, HealthCheckMiddleware, JSONSchemaType, NewrelicMetricsReporter, NewrelicTraceExporter, OBJECTID_TYPE, OpenAPIExtractor, OpenAPIMixin, OperationObject, PartialCustomServiceSchema, RefExtractor, ReferenceObject, SCHEMA_REF_NAME, SchemaObject, ServiceFactory, SomeJSONSchema, addFieldsToSchema, composeSchemas, createLogger, createLoggerConfig, createOpenAPIResponses, createServiceBroker, getMetadataFromService, isServiceSelected, isZodSchema, omitFields, optionalExceptFields, optionalFields, pickFields, toPartialSchema, wrapMixin, wrapService, zodCoerceArray, zodDate, zodObjectId, zodToOpenAPISchema };
278
+ export { AjvExtractor, Alias, COERCE_ARRAY_ATTRIBUTE, CustomActionSchema, CustomServiceSchema, DATE_TYPE, Document, EMPTY_OBJECT_SCHEMA, HealthCheckMiddleware, JSONSchemaType, OBJECTID_TYPE, OpenAPIExtractor, OpenAPIMixin, OperationObject, PartialCustomServiceSchema, RefExtractor, ReferenceObject, SCHEMA_REF_NAME, SchemaObject, ServiceFactory, SomeJSONSchema, addFieldsToSchema, composeSchemas, createLogger, createLoggerConfig, createOpenAPIResponses, createServiceBroker, getMetadataFromService, isServiceSelected, isZodSchema, omitFields, optionalExceptFields, optionalFields, pickFields, toPartialSchema, wrapMixin, wrapService, zodCoerceArray, zodDate, zodObjectId, zodToOpenAPISchema };
390
279
  export type { OpenAPIMixinOptions, OpenAPIResponses, Selector, _InferredServiceSchema };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SCHEMA_REF_NAME, i as isZodSchema, z as zodToOpenAPISchema, o as omitFields, G as GetOpenApiParamsSchema, V as ValidationErrorSchema, F as FileTooBigSchema, a as FileNotExistSchema, U as UnauthorizedErrorSchema, b as ServerErrorSchema, C as COERCE_ARRAY_ATTRIBUTE } from './index-8Cv0B4uH.mjs';
2
- export { D as DATE_TYPE, E as EMPTY_OBJECT_SCHEMA, O as OBJECTID_TYPE, c as addFieldsToSchema, d as composeSchemas, e as createOpenAPIResponses, f as optionalExceptFields, g as optionalFields, p as pickFields, t as toPartialSchema, h as zodCoerceArray, j as zodDate, k as zodObjectId } from './index-8Cv0B4uH.mjs';
1
+ import { S as SCHEMA_REF_NAME, i as isZodSchema, z as zodToOpenAPISchema, o as omitFields, G as GetOpenApiParamsSchema, V as ValidationErrorSchema, F as FileTooBigSchema, a as FileNotExistSchema, U as UnauthorizedErrorSchema, b as ServerErrorSchema, C as COERCE_ARRAY_ATTRIBUTE } from './index-BMLRFTWF.mjs';
2
+ export { D as DATE_TYPE, E as EMPTY_OBJECT_SCHEMA, O as OBJECTID_TYPE, c as addFieldsToSchema, d as composeSchemas, e as createOpenAPIResponses, f as optionalExceptFields, g as optionalFields, p as pickFields, t as toPartialSchema, h as zodCoerceArray, j as zodDate, k as zodObjectId } from './index-BMLRFTWF.mjs';
3
3
  import { Ajv2019 } from 'ajv/dist/2019.js';
4
4
  import { Validators, Errors, Context, ServiceBroker, Service, TracerExporters, MetricReporters } from 'moleculer';
5
5
  import addFormats from 'ajv-formats';
@@ -1380,7 +1380,6 @@ function flattenTags(obj, convertToString = false, path = "") {
1380
1380
 
1381
1381
  const gzipPromise = promisify(gzip);
1382
1382
  class NewrelicTraceExporter extends TracerExporters.Base {
1383
- opts = {};
1384
1383
  queue;
1385
1384
  timer = null;
1386
1385
  defaultTags = {};
@@ -1497,7 +1496,6 @@ class NewrelicTraceExporter extends TracerExporters.Base {
1497
1496
  }
1498
1497
 
1499
1498
  class NewrelicMetricsReporter extends MetricReporters.Base {
1500
- opts = {};
1501
1499
  timer = null;
1502
1500
  defaultTags = {};
1503
1501
  constructor(opts) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('../index-lmnhNH-8.cjs');
3
+ var index = require('../index-CbFCa8NT.cjs');
4
4
  var moleculer = require('moleculer');
5
5
  var esToolkit = require('es-toolkit');
6
6
  var v4 = require('zod/v4');
@@ -1,7 +1,7 @@
1
1
  import { Document, ObjectId, WithoutId, InferIdType, Filter, OptionalId, WithId, CountDocumentsOptions, DeleteOptions, FindOneAndDeleteOptions, FindOptions, BulkWriteOptions, FindOneAndUpdateOptions, UpdateOptions, FindOneAndReplaceOptions, CollationOptions, CreateCollectionOptions, MongoClient, CollectionOptions, Collection, UpdateFilter, FindCursor, UpdateResult } from 'mongodb';
2
2
  import { ActionVisibility, Validators, Errors, Context } from 'moleculer';
3
3
  import { ZodType, ZodObject } from 'zod/v4';
4
- import { Y as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
4
+ import { _ as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.cjs';
5
5
  import { Readable } from 'stream';
6
6
  import 'bson';
7
7
  import 'ajv/dist/2019.js';
@@ -839,7 +839,7 @@ declare function optimizeQuery<T extends Record<string, unknown>>(query: Filter<
839
839
  * Return an object with each list item as key and 1/0/-1 as value
840
840
  * to be used in mongo projection or sort.
841
841
  */
842
- declare function getQueryFromList<T extends 'sort' | 'projection', NotOp extends T extends 'sort' ? -1 : 0>(type: T, list?: string[]): Record<string, 1 | NotOp> | undefined;
842
+ declare function getQueryFromList<T extends 'sort' | 'projection', NotOp extends (T extends 'sort' ? -1 : 0)>(type: T, list?: string[]): Record<string, 1 | NotOp> | undefined;
843
843
 
844
844
  declare function DatabaseMethodsMixin<TSchema extends Document & {
845
845
  _id: ObjectId | string;
@@ -1,7 +1,7 @@
1
1
  import { Document, ObjectId, WithoutId, InferIdType, Filter, OptionalId, WithId, CountDocumentsOptions, DeleteOptions, FindOneAndDeleteOptions, FindOptions, BulkWriteOptions, FindOneAndUpdateOptions, UpdateOptions, FindOneAndReplaceOptions, CollationOptions, CreateCollectionOptions, MongoClient, CollectionOptions, Collection, UpdateFilter, FindCursor, UpdateResult } from 'mongodb';
2
2
  import { ActionVisibility, Validators, Errors, Context } from 'moleculer';
3
3
  import { ZodType, ZodObject } from 'zod/v4';
4
- import { Y as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
4
+ import { _ as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.mjs';
5
5
  import { Readable } from 'stream';
6
6
  import 'bson';
7
7
  import 'ajv/dist/2019.js';
@@ -839,7 +839,7 @@ declare function optimizeQuery<T extends Record<string, unknown>>(query: Filter<
839
839
  * Return an object with each list item as key and 1/0/-1 as value
840
840
  * to be used in mongo projection or sort.
841
841
  */
842
- declare function getQueryFromList<T extends 'sort' | 'projection', NotOp extends T extends 'sort' ? -1 : 0>(type: T, list?: string[]): Record<string, 1 | NotOp> | undefined;
842
+ declare function getQueryFromList<T extends 'sort' | 'projection', NotOp extends (T extends 'sort' ? -1 : 0)>(type: T, list?: string[]): Record<string, 1 | NotOp> | undefined;
843
843
 
844
844
  declare function DatabaseMethodsMixin<TSchema extends Document & {
845
845
  _id: ObjectId | string;
@@ -1,4 +1,4 @@
1
- import { g as optionalFields, o as omitFields, S as SCHEMA_REF_NAME, O as OBJECTID_TYPE, C as COERCE_ARRAY_ATTRIBUTE, i as isZodSchema, k as zodObjectId, h as zodCoerceArray, e as createOpenAPIResponses } from '../index-8Cv0B4uH.mjs';
1
+ import { g as optionalFields, o as omitFields, S as SCHEMA_REF_NAME, O as OBJECTID_TYPE, C as COERCE_ARRAY_ATTRIBUTE, i as isZodSchema, k as zodObjectId, h as zodCoerceArray, e as createOpenAPIResponses } from '../index-BMLRFTWF.mjs';
2
2
  import { Errors } from 'moleculer';
3
3
  import { isEqual as isEqual$1 } from 'es-toolkit';
4
4
  import { z } from 'zod/v4';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.cjs';
2
2
  import { buildClient, NodeCachingMaterialsManager } from '@aws-crypto/client-node';
3
3
  import 'moleculer';
4
4
  import 'bson';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.mjs';
2
2
  import { buildClient, NodeCachingMaterialsManager } from '@aws-crypto/client-node';
3
3
  import 'moleculer';
4
4
  import 'bson';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.cjs';
2
2
  import 'moleculer';
3
3
  import 'bson';
4
4
  import 'zod/v4';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.mjs';
2
2
  import 'moleculer';
3
3
  import 'bson';
4
4
  import 'zod/v4';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.cjs';
2
2
  import { SignOptions, PrivateKey, VerifyOptions, JwtHeader, SigningKeyCallback } from 'jsonwebtoken';
3
3
  import { Options, JwksClient } from 'jwks-rsa';
4
4
  import { Context } from 'moleculer';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.mjs';
2
2
  import { SignOptions, PrivateKey, VerifyOptions, JwtHeader, SigningKeyCallback } from 'jsonwebtoken';
3
3
  import { Options, JwksClient } from 'jwks-rsa';
4
4
  import { Context } from 'moleculer';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.cjs';
2
2
  import { Redis } from 'ioredis';
3
3
  import { QueueOptions, Queue, JobsOptions, Job, QueueEventsOptions, QueueEvents, QueueBaseOptions, FlowProducer, RepeatOptions, WorkerOptions, Worker } from 'bullmq';
4
4
  import { Service } from 'moleculer';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.mjs';
2
2
  import { Redis } from 'ioredis';
3
3
  import { QueueOptions, Queue, JobsOptions, Job, QueueEventsOptions, QueueEvents, QueueBaseOptions, FlowProducer, RepeatOptions, WorkerOptions, Worker } from 'bullmq';
4
4
  import { Service } from 'moleculer';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.cjs';
2
2
  import { RedisOptions, Redis } from 'ioredis';
3
3
  import { Service } from 'moleculer';
4
4
  import 'bson';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.mjs';
2
2
  import { RedisOptions, Redis } from 'ioredis';
3
3
  import { Service } from 'moleculer';
4
4
  import 'bson';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.cjs';
2
2
  import { Service } from 'moleculer';
3
3
  import { RedisOptions, Redis } from 'ioredis';
4
4
  import Redlock from 'redlock';
@@ -1,4 +1,4 @@
1
- import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../newrelic-metrics-reporter-CmRMT4LG.mjs';
2
2
  import { Service } from 'moleculer';
3
3
  import { RedisOptions, Redis } from 'ioredis';
4
4
  import Redlock from 'redlock';
@@ -1,4 +1,4 @@
1
- import { ActionSchema, Context, Validators, Middleware, EventSchema, Service, ServiceHooks, Logger, ServiceBroker, ActionEndpoint, EventEndpoint, Span } from 'moleculer';
1
+ import { ActionSchema, Context, Validators, Middleware, EventSchema, Service, ServiceHooks, Logger, ServiceBroker, ActionEndpoint, EventEndpoint, Span, TracerExporters, Tracer, MetricReporters, MetricRegistry } from 'moleculer';
2
2
  import { ObjectId } from 'bson';
3
3
  import { ZodType, z } from 'zod/v4';
4
4
  import { Options, ErrorObject } from 'ajv/dist/2019.js';
@@ -615,5 +615,128 @@ declare module 'pino' {
615
615
  }
616
616
  }
617
617
 
618
- export { ZodValidator as Z, AjvValidator as d, ContextFactory as i };
619
- export type { Alias as A, ResponsesObject as B, CustomActionSchema as C, Document as D, EncodingObject as E, SecurityRequirementObject as F, SecuritySchemeObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, ServerObject as K, LicenseObject as L, MoleculerLoggerConfigOptions as M, ServerVariableObject as N, OperationObject as O, PartialCustomServiceSchema as P, Transform as Q, ReferenceObject as R, SomeJSONSchema as S, TagObject as T, TransformField as U, TransformLevel as V, TransformMap as W, Transformer as X, ValidationSchema as Y, SchemaObject as a, CustomServiceSchema as b, CreateLoggerOptions as c, ApiKeySecurityScheme as e, CallbackObject as f, ComponentsObject as g, ContactObject as h, ExampleObject as j, ExternalDocumentationObject as k, HttpSecurityScheme as l, CallbackServiceThis as m, ObjectServiceThis as n, LinkObject as o, MediaTypeObject as p, OAuth2SecurityScheme as q, OpenIdSecurityScheme as r, ParameterBaseObject as s, ParameterObject as t, PathItemObject as u, PathsObject as v, PropertiesSchema as w, RequestBodyObject as x, RequiredMembers as y, ResponseObject as z };
618
+ type NewrelicTraceExporterOptions = {
619
+ logger?: Logger;
620
+ safetyTags?: boolean;
621
+ /**
622
+ * Base URL for NewRelic server.
623
+ */
624
+ baseURL?: string;
625
+ /**
626
+ * Maximum number of spans to be sent in one time.
627
+ */
628
+ batchSize?: number;
629
+ /**
630
+ * NewRelic Insert API Key.
631
+ */
632
+ insertKey?: string;
633
+ /**
634
+ * Batch send time interval in seconds.
635
+ */
636
+ interval?: number;
637
+ /**
638
+ * Default span tags.
639
+ */
640
+ defaultTags?: Record<string, unknown> | ((tracer?: unknown) => Record<string, unknown>);
641
+ };
642
+ /**
643
+ * >>> Hard copy of the moleculer NewRelic provider. It didn't handle errors correctly
644
+ *
645
+ * Trace Exporter for NewRelic using Zipkin data.
646
+ *
647
+ * NewRelic zipkin tracer: https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/trace-api/report-zipkin-format-traces-trace-api
648
+ * API v2: https://zipkin.io/zipkin-api/#/
649
+ */
650
+ declare class NewrelicTraceExporter extends TracerExporters.Base {
651
+ private queue;
652
+ private timer;
653
+ private defaultTags;
654
+ constructor(opts: NewrelicTraceExporterOptions);
655
+ /**
656
+ * Initialize Trace Exporter.
657
+ */
658
+ init(tracer: Tracer): void;
659
+ /**
660
+ * Stop Trace exporter
661
+ */
662
+ stop(): Promise<void>;
663
+ /**
664
+ * Span is finished.
665
+ */
666
+ spanFinished(span: Span): void;
667
+ /**
668
+ * Flush tracing data to NewRelic Zipkin api endpoint
669
+ */
670
+ flush(): Promise<void>;
671
+ /**
672
+ * Generate tracing data for NewRelic
673
+ */
674
+ generateTracingData(): unknown[];
675
+ /**
676
+ * Create NewRelic v1 payload
677
+ */
678
+ makePayload(span: Span): unknown;
679
+ }
680
+ declare module 'moleculer' {
681
+ namespace TracerExporters {
682
+ interface Base {
683
+ opts: NewrelicTraceExporterOptions;
684
+ }
685
+ }
686
+ }
687
+
688
+ type DefaultTags = Record<string, unknown> | ((registry: MetricRegistry) => Record<string, unknown>);
689
+ type NewrelicMetricsOptions = MetricReporters.Base.MetricReporterOptions & {
690
+ /**
691
+ * Base URL for NewRelic server.
692
+ */
693
+ baseURL?: string;
694
+ /**
695
+ * NewRelic Insert API Key
696
+ */
697
+ insertKey?: string;
698
+ /**
699
+ * Batch send time interval in seconds.
700
+ */
701
+ interval?: number;
702
+ /**
703
+ * Default tags to be added to all metrics.
704
+ */
705
+ defaultTags?: DefaultTags;
706
+ };
707
+ /**
708
+ * NewRelic metrics reporter.
709
+ *
710
+ * NewRelic API: https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/metric-data-type/
711
+ */
712
+ declare class NewrelicMetricsReporter extends MetricReporters.Base {
713
+ private timer;
714
+ private defaultTags;
715
+ constructor(opts: NewrelicMetricsOptions);
716
+ /**
717
+ * Initialize Trace Exporter.
718
+ */
719
+ init(registry: MetricRegistry): void;
720
+ /**
721
+ * Stop Trace exporter
722
+ */
723
+ stop(): Promise<void>;
724
+ /**
725
+ * Flush tracing data to NewRelic Zipkin api endpoint
726
+ */
727
+ flush(): Promise<void>;
728
+ /**
729
+ * Generate metrics data for NewRelic
730
+ */
731
+ generateMetricsPayload(): unknown[];
732
+ }
733
+ declare module 'moleculer' {
734
+ namespace MetricReporters {
735
+ interface Base {
736
+ opts: NewrelicMetricsOptions;
737
+ }
738
+ }
739
+ }
740
+
741
+ export { ZodValidator as $, NewrelicMetricsReporter as N, AjvValidator as d, ContextFactory as i, NewrelicTraceExporter as q };
742
+ export type { Alias as A, ResponseObject as B, CustomActionSchema as C, Document as D, EncodingObject as E, ResponsesObject as F, SecurityRequirementObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, SecuritySchemeObject as K, LicenseObject as L, MoleculerLoggerConfigOptions as M, OperationObject as O, PartialCustomServiceSchema as P, ServerObject as Q, ReferenceObject as R, SomeJSONSchema as S, ServerVariableObject as T, TagObject as U, Transform as V, TransformField as W, TransformLevel as X, TransformMap as Y, Transformer as Z, ValidationSchema as _, SchemaObject as a, CustomServiceSchema as b, CreateLoggerOptions as c, ApiKeySecurityScheme as e, CallbackObject as f, ComponentsObject as g, ContactObject as h, ExampleObject as j, ExternalDocumentationObject as k, HttpSecurityScheme as l, CallbackServiceThis as m, ObjectServiceThis as n, LinkObject as o, MediaTypeObject as p, OAuth2SecurityScheme as r, OpenIdSecurityScheme as s, ParameterBaseObject as t, ParameterObject as u, PathItemObject as v, PathsObject as w, PropertiesSchema as x, RequestBodyObject as y, RequiredMembers as z };
@@ -1,4 +1,4 @@
1
- import { ActionSchema, Context, Validators, Middleware, EventSchema, Service, ServiceHooks, Logger, ServiceBroker, ActionEndpoint, EventEndpoint, Span } from 'moleculer';
1
+ import { ActionSchema, Context, Validators, Middleware, EventSchema, Service, ServiceHooks, Logger, ServiceBroker, ActionEndpoint, EventEndpoint, Span, TracerExporters, Tracer, MetricReporters, MetricRegistry } from 'moleculer';
2
2
  import { ObjectId } from 'bson';
3
3
  import { ZodType, z } from 'zod/v4';
4
4
  import { Options, ErrorObject } from 'ajv/dist/2019.js';
@@ -615,5 +615,128 @@ declare module 'pino' {
615
615
  }
616
616
  }
617
617
 
618
- export { ZodValidator as Z, AjvValidator as d, ContextFactory as i };
619
- export type { Alias as A, ResponsesObject as B, CustomActionSchema as C, Document as D, EncodingObject as E, SecurityRequirementObject as F, SecuritySchemeObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, ServerObject as K, LicenseObject as L, MoleculerLoggerConfigOptions as M, ServerVariableObject as N, OperationObject as O, PartialCustomServiceSchema as P, Transform as Q, ReferenceObject as R, SomeJSONSchema as S, TagObject as T, TransformField as U, TransformLevel as V, TransformMap as W, Transformer as X, ValidationSchema as Y, SchemaObject as a, CustomServiceSchema as b, CreateLoggerOptions as c, ApiKeySecurityScheme as e, CallbackObject as f, ComponentsObject as g, ContactObject as h, ExampleObject as j, ExternalDocumentationObject as k, HttpSecurityScheme as l, CallbackServiceThis as m, ObjectServiceThis as n, LinkObject as o, MediaTypeObject as p, OAuth2SecurityScheme as q, OpenIdSecurityScheme as r, ParameterBaseObject as s, ParameterObject as t, PathItemObject as u, PathsObject as v, PropertiesSchema as w, RequestBodyObject as x, RequiredMembers as y, ResponseObject as z };
618
+ type NewrelicTraceExporterOptions = {
619
+ logger?: Logger;
620
+ safetyTags?: boolean;
621
+ /**
622
+ * Base URL for NewRelic server.
623
+ */
624
+ baseURL?: string;
625
+ /**
626
+ * Maximum number of spans to be sent in one time.
627
+ */
628
+ batchSize?: number;
629
+ /**
630
+ * NewRelic Insert API Key.
631
+ */
632
+ insertKey?: string;
633
+ /**
634
+ * Batch send time interval in seconds.
635
+ */
636
+ interval?: number;
637
+ /**
638
+ * Default span tags.
639
+ */
640
+ defaultTags?: Record<string, unknown> | ((tracer?: unknown) => Record<string, unknown>);
641
+ };
642
+ /**
643
+ * >>> Hard copy of the moleculer NewRelic provider. It didn't handle errors correctly
644
+ *
645
+ * Trace Exporter for NewRelic using Zipkin data.
646
+ *
647
+ * NewRelic zipkin tracer: https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/trace-api/report-zipkin-format-traces-trace-api
648
+ * API v2: https://zipkin.io/zipkin-api/#/
649
+ */
650
+ declare class NewrelicTraceExporter extends TracerExporters.Base {
651
+ private queue;
652
+ private timer;
653
+ private defaultTags;
654
+ constructor(opts: NewrelicTraceExporterOptions);
655
+ /**
656
+ * Initialize Trace Exporter.
657
+ */
658
+ init(tracer: Tracer): void;
659
+ /**
660
+ * Stop Trace exporter
661
+ */
662
+ stop(): Promise<void>;
663
+ /**
664
+ * Span is finished.
665
+ */
666
+ spanFinished(span: Span): void;
667
+ /**
668
+ * Flush tracing data to NewRelic Zipkin api endpoint
669
+ */
670
+ flush(): Promise<void>;
671
+ /**
672
+ * Generate tracing data for NewRelic
673
+ */
674
+ generateTracingData(): unknown[];
675
+ /**
676
+ * Create NewRelic v1 payload
677
+ */
678
+ makePayload(span: Span): unknown;
679
+ }
680
+ declare module 'moleculer' {
681
+ namespace TracerExporters {
682
+ interface Base {
683
+ opts: NewrelicTraceExporterOptions;
684
+ }
685
+ }
686
+ }
687
+
688
+ type DefaultTags = Record<string, unknown> | ((registry: MetricRegistry) => Record<string, unknown>);
689
+ type NewrelicMetricsOptions = MetricReporters.Base.MetricReporterOptions & {
690
+ /**
691
+ * Base URL for NewRelic server.
692
+ */
693
+ baseURL?: string;
694
+ /**
695
+ * NewRelic Insert API Key
696
+ */
697
+ insertKey?: string;
698
+ /**
699
+ * Batch send time interval in seconds.
700
+ */
701
+ interval?: number;
702
+ /**
703
+ * Default tags to be added to all metrics.
704
+ */
705
+ defaultTags?: DefaultTags;
706
+ };
707
+ /**
708
+ * NewRelic metrics reporter.
709
+ *
710
+ * NewRelic API: https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/metric-data-type/
711
+ */
712
+ declare class NewrelicMetricsReporter extends MetricReporters.Base {
713
+ private timer;
714
+ private defaultTags;
715
+ constructor(opts: NewrelicMetricsOptions);
716
+ /**
717
+ * Initialize Trace Exporter.
718
+ */
719
+ init(registry: MetricRegistry): void;
720
+ /**
721
+ * Stop Trace exporter
722
+ */
723
+ stop(): Promise<void>;
724
+ /**
725
+ * Flush tracing data to NewRelic Zipkin api endpoint
726
+ */
727
+ flush(): Promise<void>;
728
+ /**
729
+ * Generate metrics data for NewRelic
730
+ */
731
+ generateMetricsPayload(): unknown[];
732
+ }
733
+ declare module 'moleculer' {
734
+ namespace MetricReporters {
735
+ interface Base {
736
+ opts: NewrelicMetricsOptions;
737
+ }
738
+ }
739
+ }
740
+
741
+ export { ZodValidator as $, NewrelicMetricsReporter as N, AjvValidator as d, ContextFactory as i, NewrelicTraceExporter as q };
742
+ export type { Alias as A, ResponseObject as B, CustomActionSchema as C, Document as D, EncodingObject as E, ResponsesObject as F, SecurityRequirementObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, SecuritySchemeObject as K, LicenseObject as L, MoleculerLoggerConfigOptions as M, OperationObject as O, PartialCustomServiceSchema as P, ServerObject as Q, ReferenceObject as R, SomeJSONSchema as S, ServerVariableObject as T, TagObject as U, Transform as V, TransformField as W, TransformLevel as X, TransformMap as Y, Transformer as Z, ValidationSchema as _, SchemaObject as a, CustomServiceSchema as b, CreateLoggerOptions as c, ApiKeySecurityScheme as e, CallbackObject as f, ComponentsObject as g, ContactObject as h, ExampleObject as j, ExternalDocumentationObject as k, HttpSecurityScheme as l, CallbackServiceThis as m, ObjectServiceThis as n, LinkObject as o, MediaTypeObject as p, OAuth2SecurityScheme as r, OpenIdSecurityScheme as s, ParameterBaseObject as t, ParameterObject as u, PathItemObject as v, PathsObject as w, PropertiesSchema as x, RequestBodyObject as y, RequiredMembers as z };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type": "git",
7
7
  "url": "https://github.com/treatwell/moleculer-essentials"
8
8
  },
9
- "version": "2.1.1-beta.1",
9
+ "version": "2.1.1",
10
10
  "main": "./dist/index.cjs",
11
11
  "module": "./dist/index.mjs",
12
12
  "types": "./dist/index.d.cts",
@@ -113,11 +113,11 @@
113
113
  "pino-pretty": "^13.1.3"
114
114
  },
115
115
  "peerDependencies": {
116
- "@aws-crypto/client-node": "^4.2.1",
116
+ "@aws-crypto/client-node": "^4.2.1 || ^5.0.0",
117
117
  "bullmq": "^5.12.10",
118
118
  "ioredis": "^5.2.3",
119
119
  "jsonwebtoken": "^9.0.2",
120
- "jwks-rsa": "^3.0.1",
120
+ "jwks-rsa": "^3.0.1 || ^4.0.1",
121
121
  "moleculer": "^0.15.0",
122
122
  "mongodb": "^6.15.0 || ^7.1.0",
123
123
  "redlock": "^4.2.0",
@@ -149,32 +149,32 @@
149
149
  "devDependencies": {
150
150
  "@aws-crypto/client-node": "^4.2.2",
151
151
  "@eslint/js": "^10.0.1",
152
- "@treatwell/eslint-plugin-moleculer": "^1.1.3",
152
+ "@treatwell/eslint-plugin-moleculer": "^1.1.4",
153
153
  "@tsconfig/node-lts": "^24.0.0",
154
154
  "@types/jsonwebtoken": "^9.0.10",
155
- "@types/node": "^24.12.0",
155
+ "@types/node": "^24.13.3",
156
156
  "@types/redlock": "^4.0.8",
157
157
  "bullmq": "^5.71.1",
158
- "eslint": "^10.1.0",
158
+ "eslint": "^10.8.1",
159
159
  "eslint-config-prettier": "^10.1.8",
160
- "eslint-import-resolver-typescript": "^4.4.4",
160
+ "eslint-import-resolver-typescript": "^4.4.5",
161
161
  "eslint-plugin-import": "^2.32.0",
162
- "eslint-plugin-prettier": "^5.5.5",
162
+ "eslint-plugin-prettier": "^5.5.6",
163
163
  "ioredis": "^5.10.1",
164
- "jiti": "^2.6.1",
164
+ "jiti": "^2.7.0",
165
165
  "jsonwebtoken": "^9.0.3",
166
166
  "jwks-rsa": "^4.0.1",
167
- "moleculer": "^0.15.0",
168
- "mongodb": "^7.1.1",
169
- "mongodb-memory-server": "^11.0.1",
170
- "pkgroll": "2.27.0",
171
- "prettier": "^3.8.1",
167
+ "moleculer": "^0.15.1",
168
+ "mongodb": "^7.5.0",
169
+ "mongodb-memory-server": "^11.2.0",
170
+ "pkgroll": "2.27.1",
171
+ "prettier": "^3.9.6",
172
172
  "redlock": "^4.2.0",
173
- "semantic-release": "^25.0.3",
173
+ "semantic-release": "^25.0.9",
174
174
  "typescript": "~5.9.3",
175
- "typescript-eslint": "^8.57.2",
176
- "vitest": "^4.1.2",
177
- "zod": "^4.3.6"
175
+ "typescript-eslint": "^8.67.0",
176
+ "vitest": "^4.1.10",
177
+ "zod": "^4.4.3"
178
178
  },
179
179
  "files": [
180
180
  "dist"
@@ -182,5 +182,5 @@
182
182
  "publishConfig": {
183
183
  "access": "public"
184
184
  },
185
- "packageManager": "yarn@4.13.0"
185
+ "packageManager": "yarn@4.18.0"
186
186
  }