@treatwell/moleculer-essentials 2.0.1 → 2.1.0-beta.2

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/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { S as SomeJSONSchema, J as JSONSchemaType, C as CustomActionSchema, A as Alias, a as CustomServiceSchema, D as Document, b as SchemaObject, O as OperationObject, R as ReferenceObject, c as CreateLoggerOptions, M as MoleculerLoggerConfigOptions } from './types-CLAbRykR.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, P as ParameterBaseObject, s as ParameterObject, t as PathItemObject, u as PathsObject, v as PropertiesSchema, w as RequestBodyObject, x as RequiredMembers, y as ResponseObject, z as ResponsesObject, B as SecurityRequirementObject, F as SecuritySchemeObject, G as ServerObject, K as ServerVariableObject, T as TagObject, N as Transform, Q as TransformField, U as TransformLevel, V as TransformMap, W as Transformer, X as ValidationSchema, Z as ZodValidator } from './types-CLAbRykR.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 './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';
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, ServiceSchema, ServiceSettingSchema, 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, TracerExporters, Logger as Logger$1, Tracer, Span, MetricReporters, MetricRegistry } from 'moleculer';
7
7
  import { Logger } from 'pino';
8
8
  import 'pino-pretty';
9
9
 
@@ -44,7 +44,7 @@ type OpenAPIMixinOptions = {
44
44
  */
45
45
  getSecuritySchemes?: (action: Alias) => string[] | undefined | false;
46
46
  };
47
- declare function OpenAPIMixin(options: OpenAPIMixinOptions): Partial<CustomServiceSchema<{
47
+ declare function OpenAPIMixin(options: OpenAPIMixinOptions): PartialCustomServiceSchema<{
48
48
  openapi: {
49
49
  openapi: string;
50
50
  info: {
@@ -131,7 +131,7 @@ declare function OpenAPIMixin(options: OpenAPIMixinOptions): Partial<CustomServi
131
131
  * Generate the OpenAPI schema for the specified kind.
132
132
  */
133
133
  generateSchema(ctx: Context, kind?: string): Promise<Document>;
134
- }, unknown>>;
134
+ }, unknown>;
135
135
 
136
136
  /**
137
137
  * This class walks through a JSON schema and extracts all the refs.
@@ -199,13 +199,13 @@ declare class AjvExtractor extends RefExtractor {
199
199
  *
200
200
  * For now, only methods are typed.
201
201
  */
202
- declare function wrapMixin<Settings, Methods, Mixins>(svc: Partial<CustomServiceSchema<Settings, Methods, Mixins>>): typeof svc;
202
+ declare function wrapMixin<Settings, Methods, Mixins>(svc: PartialCustomServiceSchema<Settings, Methods, Mixins>): typeof svc;
203
203
  /**
204
204
  * In order to let TS emit types for inferred services, we return our own
205
205
  * type that extend the original one.
206
206
  * More on why: https://github.com/microsoft/TypeScript/pull/58176#issuecomment-2052698294
207
207
  */
208
- type _InferredServiceSchema = ServiceSchema;
208
+ type _InferredServiceSchema<TSettings = ServiceSettingSchema> = ServiceSchema<TSettings>;
209
209
  /**
210
210
  * This function is a NO-OP and is only useful for Typescript types.
211
211
  * Using Generic arguments allows TS to infer types directly from the object
@@ -214,7 +214,7 @@ type _InferredServiceSchema = ServiceSchema;
214
214
  * For the wrapService fn, it will return a moleculer ServiceSchema that will stripe
215
215
  * out every smart typing of methods. This should never be used inside a mixin.
216
216
  */
217
- declare function wrapService<Settings, Methods, Mixins>(svc: CustomServiceSchema<Settings, Methods, Mixins>): _InferredServiceSchema;
217
+ declare function wrapService<Settings, Methods, Mixins>(svc: CustomServiceSchema<Settings, Methods, Mixins>): _InferredServiceSchema<Settings>;
218
218
 
219
219
  /**
220
220
  * This class replace the default Service class in Moleculer to:
@@ -386,5 +386,5 @@ declare class NewrelicMetricsReporter extends MetricReporters.Base {
386
386
  generateMetricsPayload(): unknown[];
387
387
  }
388
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, 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 };
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 };
390
390
  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, a as CustomServiceSchema, D as Document, b as SchemaObject, O as OperationObject, R as ReferenceObject, c as CreateLoggerOptions, M as MoleculerLoggerConfigOptions } from './types-CLAbRykR.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, P as ParameterBaseObject, s as ParameterObject, t as PathItemObject, u as PathsObject, v as PropertiesSchema, w as RequestBodyObject, x as RequiredMembers, y as ResponseObject, z as ResponsesObject, B as SecurityRequirementObject, F as SecuritySchemeObject, G as ServerObject, K as ServerVariableObject, T as TagObject, N as Transform, Q as TransformField, U as TransformLevel, V as TransformMap, W as Transformer, X as ValidationSchema, Z as ZodValidator } from './types-CLAbRykR.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 './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';
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, ServiceSchema, ServiceSettingSchema, 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, TracerExporters, Logger as Logger$1, Tracer, Span, MetricReporters, MetricRegistry } from 'moleculer';
7
7
  import { Logger } from 'pino';
8
8
  import 'pino-pretty';
9
9
 
@@ -44,7 +44,7 @@ type OpenAPIMixinOptions = {
44
44
  */
45
45
  getSecuritySchemes?: (action: Alias) => string[] | undefined | false;
46
46
  };
47
- declare function OpenAPIMixin(options: OpenAPIMixinOptions): Partial<CustomServiceSchema<{
47
+ declare function OpenAPIMixin(options: OpenAPIMixinOptions): PartialCustomServiceSchema<{
48
48
  openapi: {
49
49
  openapi: string;
50
50
  info: {
@@ -131,7 +131,7 @@ declare function OpenAPIMixin(options: OpenAPIMixinOptions): Partial<CustomServi
131
131
  * Generate the OpenAPI schema for the specified kind.
132
132
  */
133
133
  generateSchema(ctx: Context, kind?: string): Promise<Document>;
134
- }, unknown>>;
134
+ }, unknown>;
135
135
 
136
136
  /**
137
137
  * This class walks through a JSON schema and extracts all the refs.
@@ -199,13 +199,13 @@ declare class AjvExtractor extends RefExtractor {
199
199
  *
200
200
  * For now, only methods are typed.
201
201
  */
202
- declare function wrapMixin<Settings, Methods, Mixins>(svc: Partial<CustomServiceSchema<Settings, Methods, Mixins>>): typeof svc;
202
+ declare function wrapMixin<Settings, Methods, Mixins>(svc: PartialCustomServiceSchema<Settings, Methods, Mixins>): typeof svc;
203
203
  /**
204
204
  * In order to let TS emit types for inferred services, we return our own
205
205
  * type that extend the original one.
206
206
  * More on why: https://github.com/microsoft/TypeScript/pull/58176#issuecomment-2052698294
207
207
  */
208
- type _InferredServiceSchema = ServiceSchema;
208
+ type _InferredServiceSchema<TSettings = ServiceSettingSchema> = ServiceSchema<TSettings>;
209
209
  /**
210
210
  * This function is a NO-OP and is only useful for Typescript types.
211
211
  * Using Generic arguments allows TS to infer types directly from the object
@@ -214,7 +214,7 @@ type _InferredServiceSchema = ServiceSchema;
214
214
  * For the wrapService fn, it will return a moleculer ServiceSchema that will stripe
215
215
  * out every smart typing of methods. This should never be used inside a mixin.
216
216
  */
217
- declare function wrapService<Settings, Methods, Mixins>(svc: CustomServiceSchema<Settings, Methods, Mixins>): _InferredServiceSchema;
217
+ declare function wrapService<Settings, Methods, Mixins>(svc: CustomServiceSchema<Settings, Methods, Mixins>): _InferredServiceSchema<Settings>;
218
218
 
219
219
  /**
220
220
  * This class replace the default Service class in Moleculer to:
@@ -386,5 +386,5 @@ declare class NewrelicMetricsReporter extends MetricReporters.Base {
386
386
  generateMetricsPayload(): unknown[];
387
387
  }
388
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, 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 };
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 };
390
390
  export type { OpenAPIMixinOptions, OpenAPIResponses, Selector, _InferredServiceSchema };
@@ -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 { X as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, a as CustomServiceSchema } from '../types-CLAbRykR.cjs';
4
+ import { Y as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
5
5
  import { Readable } from 'stream';
6
6
  import 'bson';
7
7
  import 'ajv/dist/2019.js';
@@ -492,10 +492,10 @@ type DatabaseConnectionOptions = {
492
492
  */
493
493
  uri?: string;
494
494
  };
495
- declare function DatabaseConnectionMixin<TSchema extends Record<string, unknown> = never>(opts: DatabaseConnectionOptions): Partial<CustomServiceSchema<unknown, {
495
+ declare function DatabaseConnectionMixin<TSchema extends Record<string, unknown> = never>(opts: DatabaseConnectionOptions): PartialCustomServiceSchema<unknown, {
496
496
  getMongoClient(): MongoClient;
497
497
  getCollection(options?: CollectionOptions): Collection<TSchema>;
498
- }, Partial<CustomServiceSchema<unknown, {
498
+ }, PartialCustomServiceSchema<unknown, {
499
499
  getStore(storeName: string): Map<string, {
500
500
  services: Set<unknown>;
501
501
  client: MongoClient;
@@ -504,7 +504,7 @@ declare function DatabaseConnectionMixin<TSchema extends Record<string, unknown>
504
504
  getFromStore(storeName: string, key: string): MongoClient | null;
505
505
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
506
506
  setClientToStore(storeName: string, key: string, client: MongoClient, onClose: () => Promise<void> | void): void;
507
- }, unknown>>[]>>;
507
+ }, unknown>[]>;
508
508
 
509
509
  declare const MoleculerClientError: typeof Errors.MoleculerClientError;
510
510
  declare class EntityNotFoundError extends MoleculerClientError {
@@ -798,10 +798,10 @@ type SyncIndexesOptions = {
798
798
  dropIndexes: boolean;
799
799
  };
800
800
  declare const DATABASE_INDEXES_MIXIN_SYNC_EVENT = "database-indexes-mixin.sync";
801
- declare function DatabaseIndexesMixin(opts: DatabaseIndexesOptions): Partial<CustomServiceSchema<unknown, {
801
+ declare function DatabaseIndexesMixin(opts: DatabaseIndexesOptions): PartialCustomServiceSchema<unknown, {
802
802
  _syncIndexes({ dropIndexes, createIndexes, }: SyncIndexesOptions): Promise<void>;
803
803
  _createIndexFromState(col: Collection, state: IndexState): Promise<void>;
804
- }, unknown>>;
804
+ }, unknown>;
805
805
 
806
806
  declare function getDefaultIndexName(key: Record<string, 1 | -1>): string;
807
807
  declare function isIndexNameEqual(dbIdx: MongoIndex, idx: IndexTuple): boolean;
@@ -843,7 +843,7 @@ declare function getQueryFromList<T extends 'sort' | 'projection', NotOp extends
843
843
 
844
844
  declare function DatabaseMethodsMixin<TSchema extends Document & {
845
845
  _id: ObjectId | string;
846
- }, TenantField extends KeyString<TSchema> | false = false>(opts: DatabaseMethodsOptions<TSchema, TenantField>): Partial<CustomServiceSchema<unknown, {
846
+ }, TenantField extends KeyString<TSchema> | false = false>(opts: DatabaseMethodsOptions<TSchema, TenantField>): PartialCustomServiceSchema<unknown, {
847
847
  /**
848
848
  * Helper function that clean an update aggregation pipeline from createdAt changes.
849
849
  * Note: This method mutate the array.
@@ -938,7 +938,7 @@ declare function DatabaseMethodsMixin<TSchema extends Document & {
938
938
  * WARNING: Do not send any events. You'll have to send an event yourself.
939
939
  */
940
940
  _deleteMany(query: Filter<TSchema>, params: TenantParams<TSchema, TenantField>, options?: DatabaseDeleteManyOptions): Promise<number>;
941
- }, unknown>>;
941
+ }, unknown>;
942
942
 
943
943
  export { AjvActionSchemaFactory, DATABASE_INDEXES_MIXIN_SYNC_EVENT, DatabaseConnectionMixin, DatabaseIndexesMixin, DatabaseMethodsMixin, EntityNotFoundError, IndexStatus, QueryOp, ZodActionSchemaFactory, addQueryOps, addZodQueryOps, createActions, getDefaultIndexName, getIndexesDifference, getQueryFromList, isIndexEqual, isIndexNameEqual, isOnAtlas, optimizeQuery, optionalMongoId, parseAndValidateQuery, parseStringifiedQuery, removeMongoId, shouldAutoCreateIndexes, shouldAutoDropIndexes };
944
944
  export type { ActionCountParamsOptions, ActionCreateParamsOptions, ActionGetParamsOptions, ActionListParamsOptions, ActionSchemaFactory, ActionSchemaFactoryOptions, DatabaseActionCountInternalParams, DatabaseActionCountParams, DatabaseActionCreateParams, DatabaseActionEntityResult, DatabaseActionFindParams, DatabaseActionFindResult, DatabaseActionGetInternalParams, DatabaseActionGetParams, DatabaseActionInternalNames, DatabaseActionListParams, DatabaseActionListResult, DatabaseActionNames, DatabaseActionOptions, DatabaseActionPublishedNames, DatabaseActionRemoveParams, DatabaseActionUpdateParams, DatabaseConnectionOptions, DatabaseCountOptions, DatabaseDeleteManyOptions, DatabaseDeleteOneOptions, DatabaseEventDelete, DatabaseEventInsert, DatabaseEventUpdate, DatabaseFindOptions, DatabaseIndexesOptions, DatabaseInsertManyOptions, DatabaseInsertOneOptions, DatabaseMethodsOptions, DatabaseReplaceOneOptions, DatabaseSoftDeleteScope, DatabaseUpdateManyOptions, DatabaseUpdateOneOptions, IndexState, IndexTuple, KeyString, ListSearchIndex, MongoIndex, SearchIndexCustomAnalyzers, SearchIndexDefinition, SearchIndexField, SearchIndexFieldString, SyncIndexesOptions, TenantParams, WithDbFields, WithOptionalId };
@@ -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 { X as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, a as CustomServiceSchema } from '../types-CLAbRykR.mjs';
4
+ import { Y as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
5
5
  import { Readable } from 'stream';
6
6
  import 'bson';
7
7
  import 'ajv/dist/2019.js';
@@ -492,10 +492,10 @@ type DatabaseConnectionOptions = {
492
492
  */
493
493
  uri?: string;
494
494
  };
495
- declare function DatabaseConnectionMixin<TSchema extends Record<string, unknown> = never>(opts: DatabaseConnectionOptions): Partial<CustomServiceSchema<unknown, {
495
+ declare function DatabaseConnectionMixin<TSchema extends Record<string, unknown> = never>(opts: DatabaseConnectionOptions): PartialCustomServiceSchema<unknown, {
496
496
  getMongoClient(): MongoClient;
497
497
  getCollection(options?: CollectionOptions): Collection<TSchema>;
498
- }, Partial<CustomServiceSchema<unknown, {
498
+ }, PartialCustomServiceSchema<unknown, {
499
499
  getStore(storeName: string): Map<string, {
500
500
  services: Set<unknown>;
501
501
  client: MongoClient;
@@ -504,7 +504,7 @@ declare function DatabaseConnectionMixin<TSchema extends Record<string, unknown>
504
504
  getFromStore(storeName: string, key: string): MongoClient | null;
505
505
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
506
506
  setClientToStore(storeName: string, key: string, client: MongoClient, onClose: () => Promise<void> | void): void;
507
- }, unknown>>[]>>;
507
+ }, unknown>[]>;
508
508
 
509
509
  declare const MoleculerClientError: typeof Errors.MoleculerClientError;
510
510
  declare class EntityNotFoundError extends MoleculerClientError {
@@ -798,10 +798,10 @@ type SyncIndexesOptions = {
798
798
  dropIndexes: boolean;
799
799
  };
800
800
  declare const DATABASE_INDEXES_MIXIN_SYNC_EVENT = "database-indexes-mixin.sync";
801
- declare function DatabaseIndexesMixin(opts: DatabaseIndexesOptions): Partial<CustomServiceSchema<unknown, {
801
+ declare function DatabaseIndexesMixin(opts: DatabaseIndexesOptions): PartialCustomServiceSchema<unknown, {
802
802
  _syncIndexes({ dropIndexes, createIndexes, }: SyncIndexesOptions): Promise<void>;
803
803
  _createIndexFromState(col: Collection, state: IndexState): Promise<void>;
804
- }, unknown>>;
804
+ }, unknown>;
805
805
 
806
806
  declare function getDefaultIndexName(key: Record<string, 1 | -1>): string;
807
807
  declare function isIndexNameEqual(dbIdx: MongoIndex, idx: IndexTuple): boolean;
@@ -843,7 +843,7 @@ declare function getQueryFromList<T extends 'sort' | 'projection', NotOp extends
843
843
 
844
844
  declare function DatabaseMethodsMixin<TSchema extends Document & {
845
845
  _id: ObjectId | string;
846
- }, TenantField extends KeyString<TSchema> | false = false>(opts: DatabaseMethodsOptions<TSchema, TenantField>): Partial<CustomServiceSchema<unknown, {
846
+ }, TenantField extends KeyString<TSchema> | false = false>(opts: DatabaseMethodsOptions<TSchema, TenantField>): PartialCustomServiceSchema<unknown, {
847
847
  /**
848
848
  * Helper function that clean an update aggregation pipeline from createdAt changes.
849
849
  * Note: This method mutate the array.
@@ -938,7 +938,7 @@ declare function DatabaseMethodsMixin<TSchema extends Document & {
938
938
  * WARNING: Do not send any events. You'll have to send an event yourself.
939
939
  */
940
940
  _deleteMany(query: Filter<TSchema>, params: TenantParams<TSchema, TenantField>, options?: DatabaseDeleteManyOptions): Promise<number>;
941
- }, unknown>>;
941
+ }, unknown>;
942
942
 
943
943
  export { AjvActionSchemaFactory, DATABASE_INDEXES_MIXIN_SYNC_EVENT, DatabaseConnectionMixin, DatabaseIndexesMixin, DatabaseMethodsMixin, EntityNotFoundError, IndexStatus, QueryOp, ZodActionSchemaFactory, addQueryOps, addZodQueryOps, createActions, getDefaultIndexName, getIndexesDifference, getQueryFromList, isIndexEqual, isIndexNameEqual, isOnAtlas, optimizeQuery, optionalMongoId, parseAndValidateQuery, parseStringifiedQuery, removeMongoId, shouldAutoCreateIndexes, shouldAutoDropIndexes };
944
944
  export type { ActionCountParamsOptions, ActionCreateParamsOptions, ActionGetParamsOptions, ActionListParamsOptions, ActionSchemaFactory, ActionSchemaFactoryOptions, DatabaseActionCountInternalParams, DatabaseActionCountParams, DatabaseActionCreateParams, DatabaseActionEntityResult, DatabaseActionFindParams, DatabaseActionFindResult, DatabaseActionGetInternalParams, DatabaseActionGetParams, DatabaseActionInternalNames, DatabaseActionListParams, DatabaseActionListResult, DatabaseActionNames, DatabaseActionOptions, DatabaseActionPublishedNames, DatabaseActionRemoveParams, DatabaseActionUpdateParams, DatabaseConnectionOptions, DatabaseCountOptions, DatabaseDeleteManyOptions, DatabaseDeleteOneOptions, DatabaseEventDelete, DatabaseEventInsert, DatabaseEventUpdate, DatabaseFindOptions, DatabaseIndexesOptions, DatabaseInsertManyOptions, DatabaseInsertOneOptions, DatabaseMethodsOptions, DatabaseReplaceOneOptions, DatabaseSoftDeleteScope, DatabaseUpdateManyOptions, DatabaseUpdateOneOptions, IndexState, IndexTuple, KeyString, ListSearchIndex, MongoIndex, SearchIndexCustomAnalyzers, SearchIndexDefinition, SearchIndexField, SearchIndexFieldString, SyncIndexesOptions, TenantParams, WithDbFields, WithOptionalId };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
2
2
  import { buildClient, NodeCachingMaterialsManager } from '@aws-crypto/client-node';
3
3
  import 'moleculer';
4
4
  import 'bson';
@@ -16,7 +16,7 @@ type EncryptorMixinSettings = {
16
16
  cacheMaxMessagesEncrypted?: number;
17
17
  localMasterKey?: string;
18
18
  };
19
- declare function EncryptorMixin({ keyId, cacheMaxMessagesEncrypted, cacheMaxAge, cacheCapacity, cacheMaxBytesEncrypted, localMasterKey, }: EncryptorMixinSettings): Partial<CustomServiceSchema<unknown, {
19
+ declare function EncryptorMixin({ keyId, cacheMaxMessagesEncrypted, cacheMaxAge, cacheCapacity, cacheMaxBytesEncrypted, localMasterKey, }: EncryptorMixinSettings): PartialCustomServiceSchema<unknown, {
20
20
  getEncryptorClient(): ReturnType<typeof buildClient>;
21
21
  /**
22
22
  * Get a keyring for a specific key ID
@@ -27,7 +27,7 @@ declare function EncryptorMixin({ keyId, cacheMaxMessagesEncrypted, cacheMaxAge,
27
27
  getEncryptorCmm(): NodeCachingMaterialsManager;
28
28
  encrypt(plainData: Buffer | string): Promise<Buffer>;
29
29
  decrypt(encryptedData: Uint8Array | string): Promise<Buffer>;
30
- }, unknown>>;
30
+ }, unknown>;
31
31
 
32
32
  export { EncryptorMixin, kCmm };
33
33
  export type { EncryptorMixinSettings };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
2
2
  import { buildClient, NodeCachingMaterialsManager } from '@aws-crypto/client-node';
3
3
  import 'moleculer';
4
4
  import 'bson';
@@ -16,7 +16,7 @@ type EncryptorMixinSettings = {
16
16
  cacheMaxMessagesEncrypted?: number;
17
17
  localMasterKey?: string;
18
18
  };
19
- declare function EncryptorMixin({ keyId, cacheMaxMessagesEncrypted, cacheMaxAge, cacheCapacity, cacheMaxBytesEncrypted, localMasterKey, }: EncryptorMixinSettings): Partial<CustomServiceSchema<unknown, {
19
+ declare function EncryptorMixin({ keyId, cacheMaxMessagesEncrypted, cacheMaxAge, cacheCapacity, cacheMaxBytesEncrypted, localMasterKey, }: EncryptorMixinSettings): PartialCustomServiceSchema<unknown, {
20
20
  getEncryptorClient(): ReturnType<typeof buildClient>;
21
21
  /**
22
22
  * Get a keyring for a specific key ID
@@ -27,7 +27,7 @@ declare function EncryptorMixin({ keyId, cacheMaxMessagesEncrypted, cacheMaxAge,
27
27
  getEncryptorCmm(): NodeCachingMaterialsManager;
28
28
  encrypt(plainData: Buffer | string): Promise<Buffer>;
29
29
  decrypt(encryptedData: Uint8Array | string): Promise<Buffer>;
30
- }, unknown>>;
30
+ }, unknown>;
31
31
 
32
32
  export { EncryptorMixin, kCmm };
33
33
  export type { EncryptorMixinSettings };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
2
2
  import 'moleculer';
3
3
  import 'bson';
4
4
  import 'zod/v4';
@@ -17,7 +17,7 @@ type Wrapper<T> = {
17
17
  * - `storeName`, the name of the store (e.g. `mongodb`, `redis`, etc.)
18
18
  * - `key`, the key of the instance (e.g. `mongodb://localhost:27017`)
19
19
  */
20
- declare function GlobalStoreMixin<T = unknown>(): Partial<CustomServiceSchema<unknown, {
20
+ declare function GlobalStoreMixin<T = unknown>(): PartialCustomServiceSchema<unknown, {
21
21
  /**
22
22
  * Global store to share the adapters between services on the same broker.
23
23
  */
@@ -36,6 +36,6 @@ declare function GlobalStoreMixin<T = unknown>(): Partial<CustomServiceSchema<un
36
36
  * Set the client in global store.
37
37
  */
38
38
  setClientToStore(storeName: string, key: string, client: T, onClose: Wrapper<T>["onClose"]): void;
39
- }, unknown>>;
39
+ }, unknown>;
40
40
 
41
41
  export { GlobalStoreMixin };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
2
2
  import 'moleculer';
3
3
  import 'bson';
4
4
  import 'zod/v4';
@@ -17,7 +17,7 @@ type Wrapper<T> = {
17
17
  * - `storeName`, the name of the store (e.g. `mongodb`, `redis`, etc.)
18
18
  * - `key`, the key of the instance (e.g. `mongodb://localhost:27017`)
19
19
  */
20
- declare function GlobalStoreMixin<T = unknown>(): Partial<CustomServiceSchema<unknown, {
20
+ declare function GlobalStoreMixin<T = unknown>(): PartialCustomServiceSchema<unknown, {
21
21
  /**
22
22
  * Global store to share the adapters between services on the same broker.
23
23
  */
@@ -36,6 +36,6 @@ declare function GlobalStoreMixin<T = unknown>(): Partial<CustomServiceSchema<un
36
36
  * Set the client in global store.
37
37
  */
38
38
  setClientToStore(storeName: string, key: string, client: T, onClose: Wrapper<T>["onClose"]): void;
39
- }, unknown>>;
39
+ }, unknown>;
40
40
 
41
41
  export { GlobalStoreMixin };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.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';
@@ -20,14 +20,14 @@ type JwtSignerMixinSettings = {
20
20
  */
21
21
  disableAction?: boolean;
22
22
  };
23
- declare function JwtSignerMixin(opts: JwtSignerMixinSettings): Partial<CustomServiceSchema<unknown, {
23
+ declare function JwtSignerMixin(opts: JwtSignerMixinSettings): PartialCustomServiceSchema<unknown, {
24
24
  generateJwt(payload?: string | Buffer | object): Promise<string>;
25
- }, unknown>>;
25
+ }, unknown>;
26
26
  type JwtVerifierMixinSettings = {
27
27
  jwksOptions: Options;
28
28
  validClaim: VerifyOptions;
29
29
  };
30
- declare function JwtVerifierMixin(opts: JwtVerifierMixinSettings): Partial<CustomServiceSchema<unknown, {
30
+ declare function JwtVerifierMixin(opts: JwtVerifierMixinSettings): PartialCustomServiceSchema<unknown, {
31
31
  getJwksClient(): JwksClient;
32
32
  /**
33
33
  * Used with jsonwebtoken verify function. Retrieves the signing public key
@@ -39,7 +39,7 @@ declare function JwtVerifierMixin(opts: JwtVerifierMixinSettings): Partial<Custo
39
39
  */
40
40
  verifyJwt(token: string): Promise<void>;
41
41
  verifyAuthorizationHeader(ctx: Context, value: string | undefined): Promise<void>;
42
- }, unknown>>;
42
+ }, unknown>;
43
43
 
44
44
  export { JwtSignerMixin, JwtVerifierMixin };
45
45
  export type { JwtSignerMixinSettings, JwtVerifierMixinSettings };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.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';
@@ -20,14 +20,14 @@ type JwtSignerMixinSettings = {
20
20
  */
21
21
  disableAction?: boolean;
22
22
  };
23
- declare function JwtSignerMixin(opts: JwtSignerMixinSettings): Partial<CustomServiceSchema<unknown, {
23
+ declare function JwtSignerMixin(opts: JwtSignerMixinSettings): PartialCustomServiceSchema<unknown, {
24
24
  generateJwt(payload?: string | Buffer | object): Promise<string>;
25
- }, unknown>>;
25
+ }, unknown>;
26
26
  type JwtVerifierMixinSettings = {
27
27
  jwksOptions: Options;
28
28
  validClaim: VerifyOptions;
29
29
  };
30
- declare function JwtVerifierMixin(opts: JwtVerifierMixinSettings): Partial<CustomServiceSchema<unknown, {
30
+ declare function JwtVerifierMixin(opts: JwtVerifierMixinSettings): PartialCustomServiceSchema<unknown, {
31
31
  getJwksClient(): JwksClient;
32
32
  /**
33
33
  * Used with jsonwebtoken verify function. Retrieves the signing public key
@@ -39,7 +39,7 @@ declare function JwtVerifierMixin(opts: JwtVerifierMixinSettings): Partial<Custo
39
39
  */
40
40
  verifyJwt(token: string): Promise<void>;
41
41
  verifyAuthorizationHeader(ctx: Context, value: string | undefined): Promise<void>;
42
- }, unknown>>;
42
+ }, unknown>;
43
43
 
44
44
  export { JwtSignerMixin, JwtVerifierMixin };
45
45
  export type { JwtSignerMixinSettings, JwtVerifierMixinSettings };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.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';
@@ -19,7 +19,7 @@ type WithoutConnection<T> = Omit<T, 'connection'>;
19
19
  /**
20
20
  * This Mixin add the capability to launch a job.
21
21
  */
22
- declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnection<QueueOptions> & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
22
+ declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnection<QueueOptions> & QueueMixinOptions): PartialCustomServiceSchema<unknown, {
23
23
  _getQueues(): Map<string, Queue>;
24
24
  /**
25
25
  * Add a job to a specific queue. The queue name needs to be passed as parameters
@@ -35,7 +35,7 @@ declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnec
35
35
  * Get a queue bundle if you need specific features
36
36
  */
37
37
  getQueue(qName: N): Queue;
38
- }, Partial<CustomServiceSchema<unknown, {
38
+ }, PartialCustomServiceSchema<unknown, {
39
39
  getStore(storeName: string): Map<string, {
40
40
  services: Set<unknown>;
41
41
  client: Redis;
@@ -44,13 +44,13 @@ declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnec
44
44
  getFromStore(storeName: string, key: string): Redis | null;
45
45
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
46
46
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
47
- }, unknown>>[]>>;
47
+ }, unknown>[]>;
48
48
 
49
49
  /**
50
50
  * This Mixin add the capability to wait on a job.
51
51
  * WARNING: Needs to be used with QueueClient mixin.
52
52
  */
53
- declare function QueueEventsClient<N extends string>(queueName: N, opts: WithoutConnection<QueueEventsOptions> & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
53
+ declare function QueueEventsClient<N extends string>(queueName: N, opts: WithoutConnection<QueueEventsOptions> & QueueMixinOptions): PartialCustomServiceSchema<unknown, {
54
54
  _getQueueEvents(): Map<string, {
55
55
  events: QueueEvents;
56
56
  running: boolean;
@@ -69,7 +69,7 @@ declare function QueueEventsClient<N extends string>(queueName: N, opts: Without
69
69
  * Same as addBulkJob but will also wait for the jobs to finish before returning.
70
70
  */
71
71
  addBulkAndWait<T = unknown, D = unknown>(qName: N, name: string, data: D[], jOpts?: JobsOptions, ttl?: number): Promise<T[]>;
72
- }, Partial<CustomServiceSchema<unknown, {
72
+ }, PartialCustomServiceSchema<unknown, {
73
73
  getStore(storeName: string): Map<string, {
74
74
  services: Set<unknown>;
75
75
  client: Redis;
@@ -78,14 +78,14 @@ declare function QueueEventsClient<N extends string>(queueName: N, opts: Without
78
78
  getFromStore(storeName: string, key: string): Redis | null;
79
79
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
80
80
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
81
- }, unknown>>[]>>;
81
+ }, unknown>[]>;
82
82
 
83
83
  /**
84
84
  * This Mixin add the capability to launch a BullMQ flows.
85
85
  */
86
- declare function QueueFlowProducerMixin(opts: WithoutConnection<QueueBaseOptions> & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
86
+ declare function QueueFlowProducerMixin(opts: WithoutConnection<QueueBaseOptions> & QueueMixinOptions): PartialCustomServiceSchema<unknown, {
87
87
  getFlowProducer(): FlowProducer;
88
- }, unknown>>;
88
+ }, unknown>;
89
89
 
90
90
  type RepeatableJob = {
91
91
  name: string;
@@ -101,9 +101,9 @@ type QueueStaticRepeatableJobsOptions = {
101
101
  * This Mixin allow to register repeatable jobs and remove other ones.
102
102
  * It should mainly be setup on the same service as the related QueueWorker.
103
103
  */
104
- declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJob[], opts: QueueStaticRepeatableJobsOptions & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
104
+ declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJob[], opts: QueueStaticRepeatableJobsOptions & QueueMixinOptions): PartialCustomServiceSchema<unknown, {
105
105
  registerRepeatableJobs(): Promise<void>;
106
- }, Partial<CustomServiceSchema<unknown, {
106
+ }, PartialCustomServiceSchema<unknown, {
107
107
  getStore(storeName: string): Map<string, {
108
108
  services: Set<unknown>;
109
109
  client: Redis;
@@ -112,7 +112,7 @@ declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJo
112
112
  getFromStore(storeName: string, key: string): Redis | null;
113
113
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
114
114
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
115
- }, unknown>>[]>>;
115
+ }, unknown>[]>;
116
116
 
117
117
  type JobMeta = {
118
118
  job?: Job;
@@ -142,11 +142,11 @@ type JobProcessorOptions = {
142
142
  /**
143
143
  * This Mixin create the worker system.
144
144
  */
145
- declare function QueueWorker(queueName: string, opts: WithoutConnection<WorkerOptions> & QueueMixinOptions, processorOptions?: JobProcessorOptions): Partial<CustomServiceSchema<unknown, {
145
+ declare function QueueWorker(queueName: string, opts: WithoutConnection<WorkerOptions> & QueueMixinOptions, processorOptions?: JobProcessorOptions): PartialCustomServiceSchema<unknown, {
146
146
  getWorker(): Worker;
147
147
  processJob(job: Job, token?: string): Promise<any>;
148
148
  _processJob(job: Job, token?: string): Promise<any>;
149
- }, unknown>>;
149
+ }, unknown>;
150
150
 
151
151
  export { QueueClient, QueueEventsClient, QueueFlowProducerMixin, QueueStaticRepeatableJobs, QueueWorker };
152
152
  export type { JobMeta, JobProcessorOptions, QueueMixinOptions, QueueStaticRepeatableJobsOptions, RepeatableJob };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.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';
@@ -19,7 +19,7 @@ type WithoutConnection<T> = Omit<T, 'connection'>;
19
19
  /**
20
20
  * This Mixin add the capability to launch a job.
21
21
  */
22
- declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnection<QueueOptions> & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
22
+ declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnection<QueueOptions> & QueueMixinOptions): PartialCustomServiceSchema<unknown, {
23
23
  _getQueues(): Map<string, Queue>;
24
24
  /**
25
25
  * Add a job to a specific queue. The queue name needs to be passed as parameters
@@ -35,7 +35,7 @@ declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnec
35
35
  * Get a queue bundle if you need specific features
36
36
  */
37
37
  getQueue(qName: N): Queue;
38
- }, Partial<CustomServiceSchema<unknown, {
38
+ }, PartialCustomServiceSchema<unknown, {
39
39
  getStore(storeName: string): Map<string, {
40
40
  services: Set<unknown>;
41
41
  client: Redis;
@@ -44,13 +44,13 @@ declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnec
44
44
  getFromStore(storeName: string, key: string): Redis | null;
45
45
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
46
46
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
47
- }, unknown>>[]>>;
47
+ }, unknown>[]>;
48
48
 
49
49
  /**
50
50
  * This Mixin add the capability to wait on a job.
51
51
  * WARNING: Needs to be used with QueueClient mixin.
52
52
  */
53
- declare function QueueEventsClient<N extends string>(queueName: N, opts: WithoutConnection<QueueEventsOptions> & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
53
+ declare function QueueEventsClient<N extends string>(queueName: N, opts: WithoutConnection<QueueEventsOptions> & QueueMixinOptions): PartialCustomServiceSchema<unknown, {
54
54
  _getQueueEvents(): Map<string, {
55
55
  events: QueueEvents;
56
56
  running: boolean;
@@ -69,7 +69,7 @@ declare function QueueEventsClient<N extends string>(queueName: N, opts: Without
69
69
  * Same as addBulkJob but will also wait for the jobs to finish before returning.
70
70
  */
71
71
  addBulkAndWait<T = unknown, D = unknown>(qName: N, name: string, data: D[], jOpts?: JobsOptions, ttl?: number): Promise<T[]>;
72
- }, Partial<CustomServiceSchema<unknown, {
72
+ }, PartialCustomServiceSchema<unknown, {
73
73
  getStore(storeName: string): Map<string, {
74
74
  services: Set<unknown>;
75
75
  client: Redis;
@@ -78,14 +78,14 @@ declare function QueueEventsClient<N extends string>(queueName: N, opts: Without
78
78
  getFromStore(storeName: string, key: string): Redis | null;
79
79
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
80
80
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
81
- }, unknown>>[]>>;
81
+ }, unknown>[]>;
82
82
 
83
83
  /**
84
84
  * This Mixin add the capability to launch a BullMQ flows.
85
85
  */
86
- declare function QueueFlowProducerMixin(opts: WithoutConnection<QueueBaseOptions> & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
86
+ declare function QueueFlowProducerMixin(opts: WithoutConnection<QueueBaseOptions> & QueueMixinOptions): PartialCustomServiceSchema<unknown, {
87
87
  getFlowProducer(): FlowProducer;
88
- }, unknown>>;
88
+ }, unknown>;
89
89
 
90
90
  type RepeatableJob = {
91
91
  name: string;
@@ -101,9 +101,9 @@ type QueueStaticRepeatableJobsOptions = {
101
101
  * This Mixin allow to register repeatable jobs and remove other ones.
102
102
  * It should mainly be setup on the same service as the related QueueWorker.
103
103
  */
104
- declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJob[], opts: QueueStaticRepeatableJobsOptions & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
104
+ declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJob[], opts: QueueStaticRepeatableJobsOptions & QueueMixinOptions): PartialCustomServiceSchema<unknown, {
105
105
  registerRepeatableJobs(): Promise<void>;
106
- }, Partial<CustomServiceSchema<unknown, {
106
+ }, PartialCustomServiceSchema<unknown, {
107
107
  getStore(storeName: string): Map<string, {
108
108
  services: Set<unknown>;
109
109
  client: Redis;
@@ -112,7 +112,7 @@ declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJo
112
112
  getFromStore(storeName: string, key: string): Redis | null;
113
113
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
114
114
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
115
- }, unknown>>[]>>;
115
+ }, unknown>[]>;
116
116
 
117
117
  type JobMeta = {
118
118
  job?: Job;
@@ -142,11 +142,11 @@ type JobProcessorOptions = {
142
142
  /**
143
143
  * This Mixin create the worker system.
144
144
  */
145
- declare function QueueWorker(queueName: string, opts: WithoutConnection<WorkerOptions> & QueueMixinOptions, processorOptions?: JobProcessorOptions): Partial<CustomServiceSchema<unknown, {
145
+ declare function QueueWorker(queueName: string, opts: WithoutConnection<WorkerOptions> & QueueMixinOptions, processorOptions?: JobProcessorOptions): PartialCustomServiceSchema<unknown, {
146
146
  getWorker(): Worker;
147
147
  processJob(job: Job, token?: string): Promise<any>;
148
148
  _processJob(job: Job, token?: string): Promise<any>;
149
- }, unknown>>;
149
+ }, unknown>;
150
150
 
151
151
  export { QueueClient, QueueEventsClient, QueueFlowProducerMixin, QueueStaticRepeatableJobs, QueueWorker };
152
152
  export type { JobMeta, JobProcessorOptions, QueueMixinOptions, QueueStaticRepeatableJobsOptions, RepeatableJob };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
2
2
  import { RedisOptions, Redis } from 'ioredis';
3
3
  import { Service } from 'moleculer';
4
4
  import 'bson';
@@ -12,9 +12,9 @@ type RedisMixinOptions = {
12
12
  reuseClient?: boolean;
13
13
  getOptions?: <TService extends Service = Service>(svc: TService) => Promise<AllowedOptions>;
14
14
  };
15
- declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }?: RedisMixinOptions): Partial<CustomServiceSchema<unknown, {
15
+ declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }?: RedisMixinOptions): PartialCustomServiceSchema<unknown, {
16
16
  getRedis(): Redis;
17
- }, Partial<CustomServiceSchema<unknown, {
17
+ }, PartialCustomServiceSchema<unknown, {
18
18
  getStore(storeName: string): Map<string, {
19
19
  services: Set<unknown>;
20
20
  client: Redis;
@@ -23,7 +23,7 @@ declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }
23
23
  getFromStore(storeName: string, key: string): Redis | null;
24
24
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
25
25
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
26
- }, unknown>>[]>>;
26
+ }, unknown>[]>;
27
27
 
28
28
  export { RedisMixin };
29
29
  export type { RedisMixinOptions };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
2
2
  import { RedisOptions, Redis } from 'ioredis';
3
3
  import { Service } from 'moleculer';
4
4
  import 'bson';
@@ -12,9 +12,9 @@ type RedisMixinOptions = {
12
12
  reuseClient?: boolean;
13
13
  getOptions?: <TService extends Service = Service>(svc: TService) => Promise<AllowedOptions>;
14
14
  };
15
- declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }?: RedisMixinOptions): Partial<CustomServiceSchema<unknown, {
15
+ declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }?: RedisMixinOptions): PartialCustomServiceSchema<unknown, {
16
16
  getRedis(): Redis;
17
- }, Partial<CustomServiceSchema<unknown, {
17
+ }, PartialCustomServiceSchema<unknown, {
18
18
  getStore(storeName: string): Map<string, {
19
19
  services: Set<unknown>;
20
20
  client: Redis;
@@ -23,7 +23,7 @@ declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }
23
23
  getFromStore(storeName: string, key: string): Redis | null;
24
24
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
25
25
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
26
- }, unknown>>[]>>;
26
+ }, unknown>[]>;
27
27
 
28
28
  export { RedisMixin };
29
29
  export type { RedisMixinOptions };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.cjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.cjs';
2
2
  import { Service } from 'moleculer';
3
3
  import { RedisOptions, Redis } from 'ioredis';
4
4
  import Redlock from 'redlock';
@@ -14,10 +14,10 @@ type RedlockMixinOptions = {
14
14
  reuseClient?: boolean;
15
15
  getOptions?: <TService extends Service = Service>(svc: TService) => Promise<AllowedOptions>;
16
16
  };
17
- declare function RedlockMixin(options: AllowedOptions, { reuseClient, redLockOptions, getOptions }: RedlockMixinOptions): Partial<CustomServiceSchema<unknown, {
17
+ declare function RedlockMixin(options: AllowedOptions, { reuseClient, redLockOptions, getOptions }: RedlockMixinOptions): PartialCustomServiceSchema<unknown, {
18
18
  getRedlock(): Redlock;
19
19
  withLock<T>(lockKey: string, lockTTL: number, action: () => Promise<T>): Promise<T>;
20
- }, Partial<CustomServiceSchema<unknown, {
20
+ }, PartialCustomServiceSchema<unknown, {
21
21
  getStore(storeName: string): Map<string, {
22
22
  services: Set<unknown>;
23
23
  client: Redis;
@@ -26,7 +26,7 @@ declare function RedlockMixin(options: AllowedOptions, { reuseClient, redLockOpt
26
26
  getFromStore(storeName: string, key: string): Redis | null;
27
27
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
28
28
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
29
- }, unknown>>[]>>;
29
+ }, unknown>[]>;
30
30
 
31
31
  export { RedlockMixin };
32
32
  export type { RedlockMixinOptions };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../types-CLAbRykR.mjs';
1
+ import { P as PartialCustomServiceSchema } from '../types-Cdh7thEZ.mjs';
2
2
  import { Service } from 'moleculer';
3
3
  import { RedisOptions, Redis } from 'ioredis';
4
4
  import Redlock from 'redlock';
@@ -14,10 +14,10 @@ type RedlockMixinOptions = {
14
14
  reuseClient?: boolean;
15
15
  getOptions?: <TService extends Service = Service>(svc: TService) => Promise<AllowedOptions>;
16
16
  };
17
- declare function RedlockMixin(options: AllowedOptions, { reuseClient, redLockOptions, getOptions }: RedlockMixinOptions): Partial<CustomServiceSchema<unknown, {
17
+ declare function RedlockMixin(options: AllowedOptions, { reuseClient, redLockOptions, getOptions }: RedlockMixinOptions): PartialCustomServiceSchema<unknown, {
18
18
  getRedlock(): Redlock;
19
19
  withLock<T>(lockKey: string, lockTTL: number, action: () => Promise<T>): Promise<T>;
20
- }, Partial<CustomServiceSchema<unknown, {
20
+ }, PartialCustomServiceSchema<unknown, {
21
21
  getStore(storeName: string): Map<string, {
22
22
  services: Set<unknown>;
23
23
  client: Redis;
@@ -26,7 +26,7 @@ declare function RedlockMixin(options: AllowedOptions, { reuseClient, redLockOpt
26
26
  getFromStore(storeName: string, key: string): Redis | null;
27
27
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
28
28
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
29
- }, unknown>>[]>>;
29
+ }, unknown>[]>;
30
30
 
31
31
  export { RedlockMixin };
32
32
  export type { RedlockMixinOptions };
@@ -350,7 +350,7 @@ interface CustomActionSchema<T = unknown> extends Omit<ActionSchema, 'params' |
350
350
  openAPINames?: string[] | null;
351
351
  openapi?: OperationObject;
352
352
  bodySchemaRefName?: string;
353
- rest?: CustomRestSchema | CustomRestSchema[] | string | string[];
353
+ rest?: CustomRestSchema | CustomRestSchema[] | string | string[] | null;
354
354
  }
355
355
  type Alias = {
356
356
  actionName: string;
@@ -474,8 +474,7 @@ declare module 'moleculer' {
474
474
  }
475
475
  }
476
476
 
477
- type Unpacked<T> = T extends (infer U)[] ? U : never;
478
- type UnionToIntersection<U> = (U extends unknown ? (arg: U) => void : never) extends (arg: infer I) => void ? I : never;
477
+ type UnionToIntersection<U> = (U extends unknown ? (arg: U) => void : never) extends (arg: infer I) => void ? I & U : never;
479
478
  type OptionallyArray<T> = T | T[];
480
479
 
481
480
  type ServiceEventSchema = EventSchema & {
@@ -483,23 +482,52 @@ type ServiceEventSchema = EventSchema & {
483
482
  };
484
483
 
485
484
  /**
486
- * This type represent what is accessible from the `this` in a service file.
485
+ * For ONE particular mixin, return methods and settings.
486
+ * Will recursively check mixins.
487
+ */
488
+ type InjectedByMixin<Mixin> = (Mixin extends {
489
+ mixins?: infer NestedMixin;
490
+ } ? InjectMixins<NonNullable<NestedMixin>> : object) & (Mixin extends {
491
+ methods?: infer Methods;
492
+ } ? Methods : object) & (Mixin extends {
493
+ settings?: infer Settings;
494
+ } ? {
495
+ settings: Settings;
496
+ } : object);
497
+ /**
498
+ * For a list of mixins, get the merged resulting object to be injected
487
499
  */
488
- type ServiceThis<Settings, Methods, Mixins> = {
500
+ type InjectMixins<Mixins> = Mixins extends readonly unknown[] ? UnionToIntersection<InjectedByMixin<Mixins[number]>> : object;
501
+ /**
502
+ * Outside injected props, we have some basic props.
503
+ * We also allow any "other" props as unknown to give back some freedom.
504
+ *
505
+ */
506
+ interface BaseService<Settings> {
489
507
  actions: never;
490
508
  settings: Settings;
491
- } & Methods & Service & UnionToIntersection<Unpacked<Mixins>>['methods'] & Record<string | symbol, unknown>;
509
+ [key: string | symbol]: unknown;
510
+ }
511
+ /**
512
+ * This type represent what is accessible from the `this` in a service file.
513
+ * It tries to infer from generics:
514
+ * - Direct methods
515
+ * - Recursive mixins methods
516
+ *
517
+ * @internal Exported only for testing
518
+ */
519
+ type ServiceWithInference<Settings, Methods, Mixins> = Service & Methods & InjectMixins<Mixins> & BaseService<Settings>;
492
520
  /**
493
521
  * Type used for injecting `this` in an object.
494
522
  */
495
- type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<ServiceThis<Settings, Methods, Mixins>>;
523
+ type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<ServiceWithInference<Settings, Methods, Mixins>>;
496
524
  /**
497
525
  * Type used for injecting `this` in a simple function.
498
526
  */
499
- type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this: ServiceThis<Settings, Methods, Mixins>, ...params: Parameters) => Return;
527
+ type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this: ServiceWithInference<Settings, Methods, Mixins>, ...params: Parameters) => Return;
500
528
 
501
- interface CustomServiceSchema<Settings, Methods, Mixins> {
502
- name: string;
529
+ interface PartialCustomServiceSchema<Settings, Methods, Mixins> {
530
+ name?: string;
503
531
  version?: string | number;
504
532
  dependencies?: OptionallyArray<string | Service.ServiceDependency>;
505
533
  metadata?: Record<string, unknown>;
@@ -513,9 +541,12 @@ interface CustomServiceSchema<Settings, Methods, Mixins> {
513
541
  started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
514
542
  stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
515
543
  merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, [
516
- CustomServiceSchema<Settings, Methods, Mixins>
544
+ PartialCustomServiceSchema<Settings, Methods, Mixins>
517
545
  ]>>;
518
546
  }
547
+ interface CustomServiceSchema<Settings, Methods, Mixins> extends PartialCustomServiceSchema<Settings, Methods, Mixins> {
548
+ name: string;
549
+ }
519
550
 
520
551
  /**
521
552
  * This class replace the default Context class in Moleculer to:
@@ -585,4 +616,4 @@ declare module 'pino' {
585
616
  }
586
617
 
587
618
  export { ZodValidator as Z, AjvValidator as d, ContextFactory as i };
588
- export type { Alias as A, SecurityRequirementObject as B, CustomActionSchema as C, Document as D, EncodingObject as E, SecuritySchemeObject as F, ServerObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, ServerVariableObject as K, LicenseObject as L, MoleculerLoggerConfigOptions as M, Transform as N, OperationObject as O, ParameterBaseObject as P, TransformField as Q, ReferenceObject as R, SomeJSONSchema as S, TagObject as T, TransformLevel as U, TransformMap as V, Transformer as W, ValidationSchema as X, CustomServiceSchema as a, SchemaObject 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, ParameterObject as s, PathItemObject as t, PathsObject as u, PropertiesSchema as v, RequestBodyObject as w, RequiredMembers as x, ResponseObject as y, ResponsesObject as z };
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 };
@@ -350,7 +350,7 @@ interface CustomActionSchema<T = unknown> extends Omit<ActionSchema, 'params' |
350
350
  openAPINames?: string[] | null;
351
351
  openapi?: OperationObject;
352
352
  bodySchemaRefName?: string;
353
- rest?: CustomRestSchema | CustomRestSchema[] | string | string[];
353
+ rest?: CustomRestSchema | CustomRestSchema[] | string | string[] | null;
354
354
  }
355
355
  type Alias = {
356
356
  actionName: string;
@@ -474,8 +474,7 @@ declare module 'moleculer' {
474
474
  }
475
475
  }
476
476
 
477
- type Unpacked<T> = T extends (infer U)[] ? U : never;
478
- type UnionToIntersection<U> = (U extends unknown ? (arg: U) => void : never) extends (arg: infer I) => void ? I : never;
477
+ type UnionToIntersection<U> = (U extends unknown ? (arg: U) => void : never) extends (arg: infer I) => void ? I & U : never;
479
478
  type OptionallyArray<T> = T | T[];
480
479
 
481
480
  type ServiceEventSchema = EventSchema & {
@@ -483,23 +482,52 @@ type ServiceEventSchema = EventSchema & {
483
482
  };
484
483
 
485
484
  /**
486
- * This type represent what is accessible from the `this` in a service file.
485
+ * For ONE particular mixin, return methods and settings.
486
+ * Will recursively check mixins.
487
+ */
488
+ type InjectedByMixin<Mixin> = (Mixin extends {
489
+ mixins?: infer NestedMixin;
490
+ } ? InjectMixins<NonNullable<NestedMixin>> : object) & (Mixin extends {
491
+ methods?: infer Methods;
492
+ } ? Methods : object) & (Mixin extends {
493
+ settings?: infer Settings;
494
+ } ? {
495
+ settings: Settings;
496
+ } : object);
497
+ /**
498
+ * For a list of mixins, get the merged resulting object to be injected
487
499
  */
488
- type ServiceThis<Settings, Methods, Mixins> = {
500
+ type InjectMixins<Mixins> = Mixins extends readonly unknown[] ? UnionToIntersection<InjectedByMixin<Mixins[number]>> : object;
501
+ /**
502
+ * Outside injected props, we have some basic props.
503
+ * We also allow any "other" props as unknown to give back some freedom.
504
+ *
505
+ */
506
+ interface BaseService<Settings> {
489
507
  actions: never;
490
508
  settings: Settings;
491
- } & Methods & Service & UnionToIntersection<Unpacked<Mixins>>['methods'] & Record<string | symbol, unknown>;
509
+ [key: string | symbol]: unknown;
510
+ }
511
+ /**
512
+ * This type represent what is accessible from the `this` in a service file.
513
+ * It tries to infer from generics:
514
+ * - Direct methods
515
+ * - Recursive mixins methods
516
+ *
517
+ * @internal Exported only for testing
518
+ */
519
+ type ServiceWithInference<Settings, Methods, Mixins> = Service & Methods & InjectMixins<Mixins> & BaseService<Settings>;
492
520
  /**
493
521
  * Type used for injecting `this` in an object.
494
522
  */
495
- type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<ServiceThis<Settings, Methods, Mixins>>;
523
+ type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<ServiceWithInference<Settings, Methods, Mixins>>;
496
524
  /**
497
525
  * Type used for injecting `this` in a simple function.
498
526
  */
499
- type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this: ServiceThis<Settings, Methods, Mixins>, ...params: Parameters) => Return;
527
+ type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this: ServiceWithInference<Settings, Methods, Mixins>, ...params: Parameters) => Return;
500
528
 
501
- interface CustomServiceSchema<Settings, Methods, Mixins> {
502
- name: string;
529
+ interface PartialCustomServiceSchema<Settings, Methods, Mixins> {
530
+ name?: string;
503
531
  version?: string | number;
504
532
  dependencies?: OptionallyArray<string | Service.ServiceDependency>;
505
533
  metadata?: Record<string, unknown>;
@@ -513,9 +541,12 @@ interface CustomServiceSchema<Settings, Methods, Mixins> {
513
541
  started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
514
542
  stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
515
543
  merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, [
516
- CustomServiceSchema<Settings, Methods, Mixins>
544
+ PartialCustomServiceSchema<Settings, Methods, Mixins>
517
545
  ]>>;
518
546
  }
547
+ interface CustomServiceSchema<Settings, Methods, Mixins> extends PartialCustomServiceSchema<Settings, Methods, Mixins> {
548
+ name: string;
549
+ }
519
550
 
520
551
  /**
521
552
  * This class replace the default Context class in Moleculer to:
@@ -585,4 +616,4 @@ declare module 'pino' {
585
616
  }
586
617
 
587
618
  export { ZodValidator as Z, AjvValidator as d, ContextFactory as i };
588
- export type { Alias as A, SecurityRequirementObject as B, CustomActionSchema as C, Document as D, EncodingObject as E, SecuritySchemeObject as F, ServerObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, ServerVariableObject as K, LicenseObject as L, MoleculerLoggerConfigOptions as M, Transform as N, OperationObject as O, ParameterBaseObject as P, TransformField as Q, ReferenceObject as R, SomeJSONSchema as S, TagObject as T, TransformLevel as U, TransformMap as V, Transformer as W, ValidationSchema as X, CustomServiceSchema as a, SchemaObject 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, ParameterObject as s, PathItemObject as t, PathsObject as u, PropertiesSchema as v, RequestBodyObject as w, RequiredMembers as x, ResponseObject as y, ResponsesObject as z };
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 };
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.0.1",
9
+ "version": "2.1.0-beta.2",
10
10
  "main": "./dist/index.cjs",
11
11
  "module": "./dist/index.mjs",
12
12
  "types": "./dist/index.d.cts",