@treatwell/moleculer-essentials 2.0.0 → 2.1.0-beta.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/dist/index.d.cts +6 -6
- package/dist/index.d.mts +6 -6
- package/dist/mixins/database.mixin.d.cts +8 -8
- package/dist/mixins/database.mixin.d.mts +8 -8
- package/dist/mixins/encryptor.mixin.d.cts +3 -3
- package/dist/mixins/encryptor.mixin.d.mts +3 -3
- package/dist/mixins/global-store.mixin.d.cts +3 -3
- package/dist/mixins/global-store.mixin.d.mts +3 -3
- package/dist/mixins/jwt.mixin.d.cts +5 -5
- package/dist/mixins/jwt.mixin.d.mts +5 -5
- package/dist/mixins/queue.mixin.d.cts +14 -14
- package/dist/mixins/queue.mixin.d.mts +14 -14
- package/dist/mixins/redis.mixin.d.cts +4 -4
- package/dist/mixins/redis.mixin.d.mts +4 -4
- package/dist/mixins/redlock.mixin.d.cts +4 -4
- package/dist/mixins/redlock.mixin.d.mts +4 -4
- package/dist/{types-DLBNHgt4.d.cts → types-rbdpRATx.d.cts} +53 -12
- package/dist/{types-DLBNHgt4.d.mts → types-rbdpRATx.d.mts} +53 -12
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SomeJSONSchema, J as JSONSchemaType, C as CustomActionSchema, A as Alias,
|
|
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,
|
|
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-rbdpRATx.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-rbdpRATx.cjs';
|
|
3
3
|
import { ObjectId } from 'bson';
|
|
4
4
|
import { z, ZodType } from 'zod/v4';
|
|
5
5
|
import { Ajv2019 } from 'ajv/dist/2019.js';
|
|
@@ -44,7 +44,7 @@ type OpenAPIMixinOptions = {
|
|
|
44
44
|
*/
|
|
45
45
|
getSecuritySchemes?: (action: Alias) => string[] | undefined | false;
|
|
46
46
|
};
|
|
47
|
-
declare function OpenAPIMixin(options: OpenAPIMixinOptions):
|
|
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,7 +199,7 @@ 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:
|
|
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.
|
|
@@ -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,5 +1,5 @@
|
|
|
1
|
-
import { S as SomeJSONSchema, J as JSONSchemaType, C as CustomActionSchema, A as Alias,
|
|
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,
|
|
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-rbdpRATx.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-rbdpRATx.mjs';
|
|
3
3
|
import { ObjectId } from 'bson';
|
|
4
4
|
import { z, ZodType } from 'zod/v4';
|
|
5
5
|
import { Ajv2019 } from 'ajv/dist/2019.js';
|
|
@@ -44,7 +44,7 @@ type OpenAPIMixinOptions = {
|
|
|
44
44
|
*/
|
|
45
45
|
getSecuritySchemes?: (action: Alias) => string[] | undefined | false;
|
|
46
46
|
};
|
|
47
|
-
declare function OpenAPIMixin(options: OpenAPIMixinOptions):
|
|
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,7 +199,7 @@ 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:
|
|
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.
|
|
@@ -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 {
|
|
4
|
+
import { Y as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
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
|
-
},
|
|
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):
|
|
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>):
|
|
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 {
|
|
4
|
+
import { Y as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
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
|
-
},
|
|
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):
|
|
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>):
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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>():
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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>():
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
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):
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
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):
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
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
|
-
},
|
|
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):
|
|
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
|
-
},
|
|
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):
|
|
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):
|
|
104
|
+
declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJob[], opts: QueueStaticRepeatableJobsOptions & QueueMixinOptions): PartialCustomServiceSchema<unknown, {
|
|
105
105
|
registerRepeatableJobs(): Promise<void>;
|
|
106
|
-
},
|
|
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):
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
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
|
-
},
|
|
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):
|
|
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
|
-
},
|
|
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):
|
|
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):
|
|
104
|
+
declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJob[], opts: QueueStaticRepeatableJobsOptions & QueueMixinOptions): PartialCustomServiceSchema<unknown, {
|
|
105
105
|
registerRepeatableJobs(): Promise<void>;
|
|
106
|
-
},
|
|
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):
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
15
|
+
declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }?: RedisMixinOptions): PartialCustomServiceSchema<unknown, {
|
|
16
16
|
getRedis(): Redis;
|
|
17
|
-
},
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
15
|
+
declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }?: RedisMixinOptions): PartialCustomServiceSchema<unknown, {
|
|
16
16
|
getRedis(): Redis;
|
|
17
|
-
},
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
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
|
-
},
|
|
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 {
|
|
1
|
+
import { P as PartialCustomServiceSchema } from '../types-rbdpRATx.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):
|
|
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
|
-
},
|
|
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 };
|
|
@@ -333,6 +333,16 @@ interface Document {
|
|
|
333
333
|
'x-express-openapi-validation-strict'?: boolean;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Redefine RestSchema from API gateway to add type support
|
|
338
|
+
*/
|
|
339
|
+
interface CustomRestSchema {
|
|
340
|
+
path?: string;
|
|
341
|
+
method?: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH';
|
|
342
|
+
fullPath?: string;
|
|
343
|
+
basePath?: string;
|
|
344
|
+
type?: 'call' | 'stream' | 'multipart';
|
|
345
|
+
}
|
|
336
346
|
interface CustomActionSchema<T = unknown> extends Omit<ActionSchema, 'params' | 'handler'> {
|
|
337
347
|
params?: unknown;
|
|
338
348
|
handler?: (ctx: Context<never, never>) => Promise<T> | T;
|
|
@@ -340,7 +350,7 @@ interface CustomActionSchema<T = unknown> extends Omit<ActionSchema, 'params' |
|
|
|
340
350
|
openAPINames?: string[] | null;
|
|
341
351
|
openapi?: OperationObject;
|
|
342
352
|
bodySchemaRefName?: string;
|
|
343
|
-
rest?: string | string[];
|
|
353
|
+
rest?: CustomRestSchema | CustomRestSchema[] | string | string[];
|
|
344
354
|
}
|
|
345
355
|
type Alias = {
|
|
346
356
|
actionName: string;
|
|
@@ -464,8 +474,7 @@ declare module 'moleculer' {
|
|
|
464
474
|
}
|
|
465
475
|
}
|
|
466
476
|
|
|
467
|
-
type
|
|
468
|
-
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;
|
|
469
478
|
type OptionallyArray<T> = T | T[];
|
|
470
479
|
|
|
471
480
|
type ServiceEventSchema = EventSchema & {
|
|
@@ -473,23 +482,52 @@ type ServiceEventSchema = EventSchema & {
|
|
|
473
482
|
};
|
|
474
483
|
|
|
475
484
|
/**
|
|
476
|
-
*
|
|
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
|
|
499
|
+
*/
|
|
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
|
+
*
|
|
477
505
|
*/
|
|
478
|
-
|
|
506
|
+
interface BaseService<Settings> {
|
|
479
507
|
actions: never;
|
|
480
508
|
settings: Settings;
|
|
481
|
-
|
|
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>;
|
|
482
520
|
/**
|
|
483
521
|
* Type used for injecting `this` in an object.
|
|
484
522
|
*/
|
|
485
|
-
type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<
|
|
523
|
+
type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<ServiceWithInference<Settings, Methods, Mixins>>;
|
|
486
524
|
/**
|
|
487
525
|
* Type used for injecting `this` in a simple function.
|
|
488
526
|
*/
|
|
489
|
-
type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this:
|
|
527
|
+
type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this: ServiceWithInference<Settings, Methods, Mixins>, ...params: Parameters) => Return;
|
|
490
528
|
|
|
491
|
-
interface
|
|
492
|
-
name
|
|
529
|
+
interface PartialCustomServiceSchema<Settings, Methods, Mixins> {
|
|
530
|
+
name?: string;
|
|
493
531
|
version?: string | number;
|
|
494
532
|
dependencies?: OptionallyArray<string | Service.ServiceDependency>;
|
|
495
533
|
metadata?: Record<string, unknown>;
|
|
@@ -503,9 +541,12 @@ interface CustomServiceSchema<Settings, Methods, Mixins> {
|
|
|
503
541
|
started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
|
|
504
542
|
stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
|
|
505
543
|
merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, [
|
|
506
|
-
|
|
544
|
+
PartialCustomServiceSchema<Settings, Methods, Mixins>
|
|
507
545
|
]>>;
|
|
508
546
|
}
|
|
547
|
+
interface CustomServiceSchema<Settings, Methods, Mixins> extends PartialCustomServiceSchema<Settings, Methods, Mixins> {
|
|
548
|
+
name: string;
|
|
549
|
+
}
|
|
509
550
|
|
|
510
551
|
/**
|
|
511
552
|
* This class replace the default Context class in Moleculer to:
|
|
@@ -575,4 +616,4 @@ declare module 'pino' {
|
|
|
575
616
|
}
|
|
576
617
|
|
|
577
618
|
export { ZodValidator as Z, AjvValidator as d, ContextFactory as i };
|
|
578
|
-
export type { Alias as A,
|
|
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 };
|
|
@@ -333,6 +333,16 @@ interface Document {
|
|
|
333
333
|
'x-express-openapi-validation-strict'?: boolean;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Redefine RestSchema from API gateway to add type support
|
|
338
|
+
*/
|
|
339
|
+
interface CustomRestSchema {
|
|
340
|
+
path?: string;
|
|
341
|
+
method?: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH';
|
|
342
|
+
fullPath?: string;
|
|
343
|
+
basePath?: string;
|
|
344
|
+
type?: 'call' | 'stream' | 'multipart';
|
|
345
|
+
}
|
|
336
346
|
interface CustomActionSchema<T = unknown> extends Omit<ActionSchema, 'params' | 'handler'> {
|
|
337
347
|
params?: unknown;
|
|
338
348
|
handler?: (ctx: Context<never, never>) => Promise<T> | T;
|
|
@@ -340,7 +350,7 @@ interface CustomActionSchema<T = unknown> extends Omit<ActionSchema, 'params' |
|
|
|
340
350
|
openAPINames?: string[] | null;
|
|
341
351
|
openapi?: OperationObject;
|
|
342
352
|
bodySchemaRefName?: string;
|
|
343
|
-
rest?: string | string[];
|
|
353
|
+
rest?: CustomRestSchema | CustomRestSchema[] | string | string[];
|
|
344
354
|
}
|
|
345
355
|
type Alias = {
|
|
346
356
|
actionName: string;
|
|
@@ -464,8 +474,7 @@ declare module 'moleculer' {
|
|
|
464
474
|
}
|
|
465
475
|
}
|
|
466
476
|
|
|
467
|
-
type
|
|
468
|
-
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;
|
|
469
478
|
type OptionallyArray<T> = T | T[];
|
|
470
479
|
|
|
471
480
|
type ServiceEventSchema = EventSchema & {
|
|
@@ -473,23 +482,52 @@ type ServiceEventSchema = EventSchema & {
|
|
|
473
482
|
};
|
|
474
483
|
|
|
475
484
|
/**
|
|
476
|
-
*
|
|
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
|
|
499
|
+
*/
|
|
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
|
+
*
|
|
477
505
|
*/
|
|
478
|
-
|
|
506
|
+
interface BaseService<Settings> {
|
|
479
507
|
actions: never;
|
|
480
508
|
settings: Settings;
|
|
481
|
-
|
|
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>;
|
|
482
520
|
/**
|
|
483
521
|
* Type used for injecting `this` in an object.
|
|
484
522
|
*/
|
|
485
|
-
type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<
|
|
523
|
+
type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<ServiceWithInference<Settings, Methods, Mixins>>;
|
|
486
524
|
/**
|
|
487
525
|
* Type used for injecting `this` in a simple function.
|
|
488
526
|
*/
|
|
489
|
-
type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this:
|
|
527
|
+
type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this: ServiceWithInference<Settings, Methods, Mixins>, ...params: Parameters) => Return;
|
|
490
528
|
|
|
491
|
-
interface
|
|
492
|
-
name
|
|
529
|
+
interface PartialCustomServiceSchema<Settings, Methods, Mixins> {
|
|
530
|
+
name?: string;
|
|
493
531
|
version?: string | number;
|
|
494
532
|
dependencies?: OptionallyArray<string | Service.ServiceDependency>;
|
|
495
533
|
metadata?: Record<string, unknown>;
|
|
@@ -503,9 +541,12 @@ interface CustomServiceSchema<Settings, Methods, Mixins> {
|
|
|
503
541
|
started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
|
|
504
542
|
stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
|
|
505
543
|
merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, [
|
|
506
|
-
|
|
544
|
+
PartialCustomServiceSchema<Settings, Methods, Mixins>
|
|
507
545
|
]>>;
|
|
508
546
|
}
|
|
547
|
+
interface CustomServiceSchema<Settings, Methods, Mixins> extends PartialCustomServiceSchema<Settings, Methods, Mixins> {
|
|
548
|
+
name: string;
|
|
549
|
+
}
|
|
509
550
|
|
|
510
551
|
/**
|
|
511
552
|
* This class replace the default Context class in Moleculer to:
|
|
@@ -575,4 +616,4 @@ declare module 'pino' {
|
|
|
575
616
|
}
|
|
576
617
|
|
|
577
618
|
export { ZodValidator as Z, AjvValidator as d, ContextFactory as i };
|
|
578
|
-
export type { Alias as A,
|
|
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 };
|