@treatwell/moleculer-essentials 1.2.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +121 -0
- package/dist/{index-IHCgtNKZ.d.cts → index-TXVFWos4.d.cts} +16 -17
- package/dist/{index-IHCgtNKZ.d.mts → index-TXVFWos4.d.mts} +16 -17
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/mixins/database.mixin.d.cts +4 -4
- package/dist/mixins/database.mixin.d.mts +4 -4
- package/dist/mixins/encryptor.mixin.d.cts +2 -2
- package/dist/mixins/encryptor.mixin.d.mts +2 -2
- package/dist/mixins/global-store.mixin.d.cts +2 -2
- package/dist/mixins/global-store.mixin.d.mts +2 -2
- package/dist/mixins/jwt.mixin.d.cts +3 -3
- package/dist/mixins/jwt.mixin.d.mts +3 -3
- package/dist/mixins/queue.mixin.d.cts +6 -6
- package/dist/mixins/queue.mixin.d.mts +6 -6
- package/dist/mixins/redis.mixin.d.cts +2 -2
- package/dist/mixins/redis.mixin.d.mts +2 -2
- package/dist/mixins/redlock.mixin.d.cts +2 -2
- package/dist/mixins/redlock.mixin.d.mts +2 -2
- package/package.json +18 -18
package/README.md
CHANGED
|
@@ -158,6 +158,127 @@ export default wrapService({
|
|
|
158
158
|
|
|
159
159
|
The documentation isn't done yet, but you can check the [source code](./src/) to see what is available.
|
|
160
160
|
|
|
161
|
+
### ServiceSchema & ActionSchema overriding
|
|
162
|
+
|
|
163
|
+
By using TS declaration [merging feature](https://www.typescriptlang.org/docs/handbook/declaration-merging.html),
|
|
164
|
+
you can augment the default services and action schemas to support additional features:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
declare module '@treatwell/moleculer-essentials' {
|
|
168
|
+
export interface CustomActionSchema {
|
|
169
|
+
myCustomFeature?: number;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export default wrapService({
|
|
174
|
+
name: 'my-service',
|
|
175
|
+
actions: {
|
|
176
|
+
myAction: {
|
|
177
|
+
myCustomFeature: 'not_a_number', // TS2322: Type string is not assignable to type number
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Moleculer channels example
|
|
184
|
+
|
|
185
|
+
For example, adding support for the [`@moleculer/channels`](https://github.com/moleculerjs/moleculer-channels) package
|
|
186
|
+
can be achieved like this:
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
import { CustomActionSchema, InternalObjectServiceThis } from '@treatwell/moleculer-essentials';
|
|
190
|
+
import { Context } from 'moleculer';
|
|
191
|
+
|
|
192
|
+
declare module '@treatwell/moleculer-essentials' {
|
|
193
|
+
type DeadLetteringOptions = {
|
|
194
|
+
/**
|
|
195
|
+
* Enable dead-letter-queue
|
|
196
|
+
*/
|
|
197
|
+
enabled: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Name of the dead-letter queue
|
|
200
|
+
*/
|
|
201
|
+
queueName: string;
|
|
202
|
+
/**
|
|
203
|
+
* Name of the dead-letter exchange (only for AMQP adapter)
|
|
204
|
+
*/
|
|
205
|
+
exchangeName: string;
|
|
206
|
+
/**
|
|
207
|
+
* Options for the dead-letter exchange (only for AMQP adapter)
|
|
208
|
+
*/
|
|
209
|
+
exchangeOptions: unknown;
|
|
210
|
+
/**
|
|
211
|
+
* Options for the dead-letter queue (only for AMQP adapter)
|
|
212
|
+
*/
|
|
213
|
+
queueOptions: unknown;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
type MoleculerChannel = {
|
|
217
|
+
/**
|
|
218
|
+
* Channel/Queue/Stream name
|
|
219
|
+
* @default record name (with adapter prefix)
|
|
220
|
+
*/
|
|
221
|
+
name?: string;
|
|
222
|
+
/**
|
|
223
|
+
* Consumer group
|
|
224
|
+
* @default Service name
|
|
225
|
+
*/
|
|
226
|
+
group?: string;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Use moleculer context instead of direct payload.
|
|
230
|
+
* To have typing enabled, should always be true.
|
|
231
|
+
*
|
|
232
|
+
* @default uses Middleware `context` option (should be set to true)
|
|
233
|
+
*/
|
|
234
|
+
context?: boolean;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Maximum number of messages that can be processed simultaneously
|
|
238
|
+
*
|
|
239
|
+
* @default adapter's maxInFlight
|
|
240
|
+
*/
|
|
241
|
+
maxInFlight?: number | null;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Maximum number of retries before sending the message to dead-letter-queue.
|
|
245
|
+
*
|
|
246
|
+
* @default adapter's maxRetries (default: 3)
|
|
247
|
+
*/
|
|
248
|
+
maxRetries?: number | null;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Dead-letter-queue options
|
|
252
|
+
*
|
|
253
|
+
* @default adapter's deadLettering (default: not enabled)
|
|
254
|
+
*/
|
|
255
|
+
deadLettering?: DeadLetteringOptions | null;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Mandatory handler function (can be provided through mixins)
|
|
259
|
+
*/
|
|
260
|
+
handler?: (ctx: Context<never, never>, raw: never) => Promise<unknown> | unknown;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export interface CustomServiceSchema<Settings, Methods, Mixins> {
|
|
264
|
+
channels?: Record<string, InternalObjectServiceThis<MoleculerChannel, Settings, Methods, Mixins>>;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
export default wrapService({
|
|
270
|
+
name: 'my-service',
|
|
271
|
+
channels: {
|
|
272
|
+
'payment.processed': {
|
|
273
|
+
group: "other",
|
|
274
|
+
async handler(ctx: Context<{...}>) {
|
|
275
|
+
ctx.logger.info('Processing payment', ctx.params);
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
});
|
|
280
|
+
```
|
|
281
|
+
|
|
161
282
|
## License
|
|
162
283
|
|
|
163
284
|
[MIT](https://choosealicense.com/licenses/mit/)
|
|
@@ -347,8 +347,6 @@ interface CustomActionSchema<T = unknown> {
|
|
|
347
347
|
hooks?: ActionHooks;
|
|
348
348
|
params?: unknown;
|
|
349
349
|
disableTransforms?: boolean;
|
|
350
|
-
rateLimiter?: string;
|
|
351
|
-
rateLimiterCountTowardDefault?: boolean;
|
|
352
350
|
openAPINames?: string[] | null;
|
|
353
351
|
openapi?: OperationObject;
|
|
354
352
|
bodySchemaRefName?: string;
|
|
@@ -468,19 +466,20 @@ type ServiceEventSchema = ServiceEvent & {
|
|
|
468
466
|
/**
|
|
469
467
|
* This type represent what is accessible from the `this` in a service file.
|
|
470
468
|
*/
|
|
471
|
-
type ServiceThis<Settings, Methods, Mixins
|
|
469
|
+
type ServiceThis<Settings, Methods, Mixins> = {
|
|
472
470
|
actions: never;
|
|
473
471
|
settings: Settings;
|
|
474
|
-
} & Methods &
|
|
472
|
+
} & Methods & Service & UnionToIntersection<Unpacked<Mixins>>['methods'] & Record<string | symbol, unknown>;
|
|
475
473
|
/**
|
|
476
474
|
* Type used for injecting `this` in an object.
|
|
477
475
|
*/
|
|
478
|
-
type ObjectServiceThis<T, Settings, Methods, Mixins
|
|
476
|
+
type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<ServiceThis<Settings, Methods, Mixins>>;
|
|
479
477
|
/**
|
|
480
478
|
* Type used for injecting `this` in a simple function.
|
|
481
479
|
*/
|
|
482
|
-
type CallbackServiceThis<Return, Settings, Methods, Mixins,
|
|
483
|
-
|
|
480
|
+
type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this: ServiceThis<Settings, Methods, Mixins>, ...params: Parameters) => Return;
|
|
481
|
+
|
|
482
|
+
interface CustomServiceSchema<Settings, Methods, Mixins> {
|
|
484
483
|
name: string;
|
|
485
484
|
version?: string | number;
|
|
486
485
|
dependencies?: OptionallyArray<string | ServiceDependency>;
|
|
@@ -488,14 +487,14 @@ interface CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties> {
|
|
|
488
487
|
settings?: Settings;
|
|
489
488
|
hooks?: ServiceHooks;
|
|
490
489
|
mixins?: Mixins;
|
|
491
|
-
methods?: ObjectServiceThis<Methods, Settings, Methods, Mixins
|
|
492
|
-
actions?: Record<string, ObjectServiceThis<CustomActionSchema, Settings, Methods, Mixins
|
|
493
|
-
events?: Record<string, ObjectServiceThis<ServiceEventSchema, Settings, Methods, Mixins
|
|
494
|
-
created?: OptionallyArray<CallbackServiceThis<void, Settings, Methods, Mixins
|
|
495
|
-
started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins
|
|
496
|
-
stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins
|
|
497
|
-
merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins,
|
|
498
|
-
CustomServiceSchema<Settings, Methods, Mixins
|
|
490
|
+
methods?: ObjectServiceThis<Methods, Settings, Methods, Mixins>;
|
|
491
|
+
actions?: Record<string, ObjectServiceThis<CustomActionSchema, Settings, Methods, Mixins>>;
|
|
492
|
+
events?: Record<string, ObjectServiceThis<ServiceEventSchema, Settings, Methods, Mixins>>;
|
|
493
|
+
created?: OptionallyArray<CallbackServiceThis<void, Settings, Methods, Mixins>>;
|
|
494
|
+
started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
|
|
495
|
+
stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
|
|
496
|
+
merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, [
|
|
497
|
+
CustomServiceSchema<Settings, Methods, Mixins>
|
|
499
498
|
]>>;
|
|
500
499
|
}
|
|
501
500
|
|
|
@@ -529,5 +528,5 @@ declare module 'pino' {
|
|
|
529
528
|
}
|
|
530
529
|
}
|
|
531
530
|
|
|
532
|
-
export { createLogger as
|
|
533
|
-
export type { Alias as A, SecuritySchemeObject as B, CustomActionSchema as C, Document as D, ExternalDocumentationObject as E, CallbackObject as F, ComponentsObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, TagObject as K, LicenseObject as L, MediaTypeObject as M, PathItemObject as N, OperationObject as O, PropertiesSchema as P, ReferenceObject as R, SomeJSONSchema as S, Transformer as T, ValidationSchema as V, CustomServiceSchema as a, SchemaObject as b, RequiredMembers as c, Transform as e, TransformLevel as f, TransformMap as g, TransformField as h, ContactObject as j, ServerVariableObject as k, ServerObject as l, PathsObject as m, ParameterObject as n, ParameterBaseObject as o, ExampleObject as p, EncodingObject as q, RequestBodyObject as r, LinkObject as s, ResponseObject as t, ResponsesObject as u, SecurityRequirementObject as v, HttpSecurityScheme as w, ApiKeySecurityScheme as x, OAuth2SecurityScheme as y, OpenIdSecurityScheme as z };
|
|
531
|
+
export { createLogger as W, createLoggerConfig as X, defaultLogger as Y, ZodValidator as Z, AjvValidator as d, ContextFactory as i };
|
|
532
|
+
export type { Alias as A, SecuritySchemeObject as B, CustomActionSchema as C, Document as D, ExternalDocumentationObject as E, CallbackObject as F, ComponentsObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, TagObject as K, LicenseObject as L, MediaTypeObject as M, PathItemObject as N, OperationObject as O, PropertiesSchema as P, ObjectServiceThis as Q, ReferenceObject as R, SomeJSONSchema as S, Transformer as T, CallbackServiceThis as U, ValidationSchema as V, CustomServiceSchema as a, SchemaObject as b, RequiredMembers as c, Transform as e, TransformLevel as f, TransformMap as g, TransformField as h, ContactObject as j, ServerVariableObject as k, ServerObject as l, PathsObject as m, ParameterObject as n, ParameterBaseObject as o, ExampleObject as p, EncodingObject as q, RequestBodyObject as r, LinkObject as s, ResponseObject as t, ResponsesObject as u, SecurityRequirementObject as v, HttpSecurityScheme as w, ApiKeySecurityScheme as x, OAuth2SecurityScheme as y, OpenIdSecurityScheme as z };
|
|
@@ -347,8 +347,6 @@ interface CustomActionSchema<T = unknown> {
|
|
|
347
347
|
hooks?: ActionHooks;
|
|
348
348
|
params?: unknown;
|
|
349
349
|
disableTransforms?: boolean;
|
|
350
|
-
rateLimiter?: string;
|
|
351
|
-
rateLimiterCountTowardDefault?: boolean;
|
|
352
350
|
openAPINames?: string[] | null;
|
|
353
351
|
openapi?: OperationObject;
|
|
354
352
|
bodySchemaRefName?: string;
|
|
@@ -468,19 +466,20 @@ type ServiceEventSchema = ServiceEvent & {
|
|
|
468
466
|
/**
|
|
469
467
|
* This type represent what is accessible from the `this` in a service file.
|
|
470
468
|
*/
|
|
471
|
-
type ServiceThis<Settings, Methods, Mixins
|
|
469
|
+
type ServiceThis<Settings, Methods, Mixins> = {
|
|
472
470
|
actions: never;
|
|
473
471
|
settings: Settings;
|
|
474
|
-
} & Methods &
|
|
472
|
+
} & Methods & Service & UnionToIntersection<Unpacked<Mixins>>['methods'] & Record<string | symbol, unknown>;
|
|
475
473
|
/**
|
|
476
474
|
* Type used for injecting `this` in an object.
|
|
477
475
|
*/
|
|
478
|
-
type ObjectServiceThis<T, Settings, Methods, Mixins
|
|
476
|
+
type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<ServiceThis<Settings, Methods, Mixins>>;
|
|
479
477
|
/**
|
|
480
478
|
* Type used for injecting `this` in a simple function.
|
|
481
479
|
*/
|
|
482
|
-
type CallbackServiceThis<Return, Settings, Methods, Mixins,
|
|
483
|
-
|
|
480
|
+
type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this: ServiceThis<Settings, Methods, Mixins>, ...params: Parameters) => Return;
|
|
481
|
+
|
|
482
|
+
interface CustomServiceSchema<Settings, Methods, Mixins> {
|
|
484
483
|
name: string;
|
|
485
484
|
version?: string | number;
|
|
486
485
|
dependencies?: OptionallyArray<string | ServiceDependency>;
|
|
@@ -488,14 +487,14 @@ interface CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties> {
|
|
|
488
487
|
settings?: Settings;
|
|
489
488
|
hooks?: ServiceHooks;
|
|
490
489
|
mixins?: Mixins;
|
|
491
|
-
methods?: ObjectServiceThis<Methods, Settings, Methods, Mixins
|
|
492
|
-
actions?: Record<string, ObjectServiceThis<CustomActionSchema, Settings, Methods, Mixins
|
|
493
|
-
events?: Record<string, ObjectServiceThis<ServiceEventSchema, Settings, Methods, Mixins
|
|
494
|
-
created?: OptionallyArray<CallbackServiceThis<void, Settings, Methods, Mixins
|
|
495
|
-
started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins
|
|
496
|
-
stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins
|
|
497
|
-
merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins,
|
|
498
|
-
CustomServiceSchema<Settings, Methods, Mixins
|
|
490
|
+
methods?: ObjectServiceThis<Methods, Settings, Methods, Mixins>;
|
|
491
|
+
actions?: Record<string, ObjectServiceThis<CustomActionSchema, Settings, Methods, Mixins>>;
|
|
492
|
+
events?: Record<string, ObjectServiceThis<ServiceEventSchema, Settings, Methods, Mixins>>;
|
|
493
|
+
created?: OptionallyArray<CallbackServiceThis<void, Settings, Methods, Mixins>>;
|
|
494
|
+
started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
|
|
495
|
+
stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
|
|
496
|
+
merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, [
|
|
497
|
+
CustomServiceSchema<Settings, Methods, Mixins>
|
|
499
498
|
]>>;
|
|
500
499
|
}
|
|
501
500
|
|
|
@@ -529,5 +528,5 @@ declare module 'pino' {
|
|
|
529
528
|
}
|
|
530
529
|
}
|
|
531
530
|
|
|
532
|
-
export { createLogger as
|
|
533
|
-
export type { Alias as A, SecuritySchemeObject as B, CustomActionSchema as C, Document as D, ExternalDocumentationObject as E, CallbackObject as F, ComponentsObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, TagObject as K, LicenseObject as L, MediaTypeObject as M, PathItemObject as N, OperationObject as O, PropertiesSchema as P, ReferenceObject as R, SomeJSONSchema as S, Transformer as T, ValidationSchema as V, CustomServiceSchema as a, SchemaObject as b, RequiredMembers as c, Transform as e, TransformLevel as f, TransformMap as g, TransformField as h, ContactObject as j, ServerVariableObject as k, ServerObject as l, PathsObject as m, ParameterObject as n, ParameterBaseObject as o, ExampleObject as p, EncodingObject as q, RequestBodyObject as r, LinkObject as s, ResponseObject as t, ResponsesObject as u, SecurityRequirementObject as v, HttpSecurityScheme as w, ApiKeySecurityScheme as x, OAuth2SecurityScheme as y, OpenIdSecurityScheme as z };
|
|
531
|
+
export { createLogger as W, createLoggerConfig as X, defaultLogger as Y, ZodValidator as Z, AjvValidator as d, ContextFactory as i };
|
|
532
|
+
export type { Alias as A, SecuritySchemeObject as B, CustomActionSchema as C, Document as D, ExternalDocumentationObject as E, CallbackObject as F, ComponentsObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, TagObject as K, LicenseObject as L, MediaTypeObject as M, PathItemObject as N, OperationObject as O, PropertiesSchema as P, ObjectServiceThis as Q, ReferenceObject as R, SomeJSONSchema as S, Transformer as T, CallbackServiceThis as U, ValidationSchema as V, CustomServiceSchema as a, SchemaObject as b, RequiredMembers as c, Transform as e, TransformLevel as f, TransformMap as g, TransformField as h, ContactObject as j, ServerVariableObject as k, ServerObject as l, PathsObject as m, ParameterObject as n, ParameterBaseObject as o, ExampleObject as p, EncodingObject as q, RequestBodyObject as r, LinkObject as s, ResponseObject as t, ResponsesObject as u, SecurityRequirementObject as v, HttpSecurityScheme as w, ApiKeySecurityScheme as x, OAuth2SecurityScheme as y, OpenIdSecurityScheme as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-CjPjJvVl.cjs');
|
|
4
|
-
var
|
|
4
|
+
var _2019_ts = require('ajv/dist/2019.ts');
|
|
5
5
|
var moleculer = require('moleculer');
|
|
6
6
|
var addFormats = require('ajv-formats');
|
|
7
7
|
var addKeywords = require('ajv-keywords');
|
|
@@ -744,7 +744,7 @@ class AjvValidator extends moleculer.Validators.Base {
|
|
|
744
744
|
this.zodValidator = zodValidator;
|
|
745
745
|
this.modes = /* @__PURE__ */ new Map();
|
|
746
746
|
for (const [mode, ajvOpts] of Object.entries(opts)) {
|
|
747
|
-
const validator = new
|
|
747
|
+
const validator = new _2019_ts.Ajv2019(ajvOpts);
|
|
748
748
|
this.modes.set(mode, {
|
|
749
749
|
validator,
|
|
750
750
|
extractor: new AjvExtractor(validator)
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as JSONSchemaType, S as SomeJSONSchema, C as CustomActionSchema, A as Alias, a as CustomServiceSchema, D as Document, b as SchemaObject, O as OperationObject, R as ReferenceObject } from './index-
|
|
2
|
-
export { d as AjvValidator, x as ApiKeySecurityScheme, F as CallbackObject, G as ComponentsObject, j as ContactObject, i as ContextFactory, q as EncodingObject, p as ExampleObject, E as ExternalDocumentationObject, H as HeaderObject, w as HttpSecurityScheme, I as InfoObject, L as LicenseObject, s as LinkObject, M as MediaTypeObject, y as OAuth2SecurityScheme, z as OpenIdSecurityScheme, o as ParameterBaseObject, n as ParameterObject, N as PathItemObject, m as PathsObject, P as PropertiesSchema, r as RequestBodyObject, c as RequiredMembers, t as ResponseObject, u as ResponsesObject, v as SecurityRequirementObject, B as SecuritySchemeObject, l as ServerObject, k as ServerVariableObject, K as TagObject, e as Transform, h as TransformField, f as TransformLevel, g as TransformMap, T as Transformer, V as ValidationSchema, Z as ZodValidator,
|
|
1
|
+
import { J as JSONSchemaType, S as SomeJSONSchema, C as CustomActionSchema, A as Alias, a as CustomServiceSchema, D as Document, b as SchemaObject, O as OperationObject, R as ReferenceObject } from './index-TXVFWos4.cjs';
|
|
2
|
+
export { d as AjvValidator, x as ApiKeySecurityScheme, F as CallbackObject, G as ComponentsObject, j as ContactObject, i as ContextFactory, q as EncodingObject, p as ExampleObject, E as ExternalDocumentationObject, H as HeaderObject, w as HttpSecurityScheme, I as InfoObject, U as InternalCallbackServiceThis, Q as InternalObjectServiceThis, L as LicenseObject, s as LinkObject, M as MediaTypeObject, y as OAuth2SecurityScheme, z as OpenIdSecurityScheme, o as ParameterBaseObject, n as ParameterObject, N as PathItemObject, m as PathsObject, P as PropertiesSchema, r as RequestBodyObject, c as RequiredMembers, t as ResponseObject, u as ResponsesObject, v as SecurityRequirementObject, B as SecuritySchemeObject, l as ServerObject, k as ServerVariableObject, K as TagObject, e as Transform, h as TransformField, f as TransformLevel, g as TransformMap, T as Transformer, V as ValidationSchema, Z as ZodValidator, W as createLogger, X as createLoggerConfig, Y as defaultLogger } from './index-TXVFWos4.cjs';
|
|
3
3
|
import { ObjectId } from 'bson';
|
|
4
4
|
import { z, ZodType } from 'zod/v4';
|
|
5
5
|
import { Ajv2019 } from 'ajv/dist/2019.js';
|
|
@@ -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
|
|
202
|
+
declare function wrapMixin<Settings, Methods, Mixins>(svc: Partial<CustomServiceSchema<Settings, Methods, Mixins>>): typeof svc;
|
|
203
203
|
/**
|
|
204
204
|
* This function is a NO-OP and is only useful for Typescript types.
|
|
205
205
|
* Using Generic arguments allows TS to infer types directly from the object
|
|
@@ -208,7 +208,7 @@ declare function wrapMixin<Settings, Methods, Mixins, AdditionalProperties>(svc:
|
|
|
208
208
|
* For the wrapService fn, it will return a moleculer ServiceSchema that will stripe
|
|
209
209
|
* out every smart typing of methods. This should never be used inside a mixin.
|
|
210
210
|
*/
|
|
211
|
-
declare function wrapService<Settings, Methods, Mixins
|
|
211
|
+
declare function wrapService<Settings, Methods, Mixins>(svc: CustomServiceSchema<Settings, Methods, Mixins>): ServiceSchema;
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
214
|
* This class replace the default Service class in Moleculer to:
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as JSONSchemaType, S as SomeJSONSchema, C as CustomActionSchema, A as Alias, a as CustomServiceSchema, D as Document, b as SchemaObject, O as OperationObject, R as ReferenceObject } from './index-
|
|
2
|
-
export { d as AjvValidator, x as ApiKeySecurityScheme, F as CallbackObject, G as ComponentsObject, j as ContactObject, i as ContextFactory, q as EncodingObject, p as ExampleObject, E as ExternalDocumentationObject, H as HeaderObject, w as HttpSecurityScheme, I as InfoObject, L as LicenseObject, s as LinkObject, M as MediaTypeObject, y as OAuth2SecurityScheme, z as OpenIdSecurityScheme, o as ParameterBaseObject, n as ParameterObject, N as PathItemObject, m as PathsObject, P as PropertiesSchema, r as RequestBodyObject, c as RequiredMembers, t as ResponseObject, u as ResponsesObject, v as SecurityRequirementObject, B as SecuritySchemeObject, l as ServerObject, k as ServerVariableObject, K as TagObject, e as Transform, h as TransformField, f as TransformLevel, g as TransformMap, T as Transformer, V as ValidationSchema, Z as ZodValidator,
|
|
1
|
+
import { J as JSONSchemaType, S as SomeJSONSchema, C as CustomActionSchema, A as Alias, a as CustomServiceSchema, D as Document, b as SchemaObject, O as OperationObject, R as ReferenceObject } from './index-TXVFWos4.mjs';
|
|
2
|
+
export { d as AjvValidator, x as ApiKeySecurityScheme, F as CallbackObject, G as ComponentsObject, j as ContactObject, i as ContextFactory, q as EncodingObject, p as ExampleObject, E as ExternalDocumentationObject, H as HeaderObject, w as HttpSecurityScheme, I as InfoObject, U as InternalCallbackServiceThis, Q as InternalObjectServiceThis, L as LicenseObject, s as LinkObject, M as MediaTypeObject, y as OAuth2SecurityScheme, z as OpenIdSecurityScheme, o as ParameterBaseObject, n as ParameterObject, N as PathItemObject, m as PathsObject, P as PropertiesSchema, r as RequestBodyObject, c as RequiredMembers, t as ResponseObject, u as ResponsesObject, v as SecurityRequirementObject, B as SecuritySchemeObject, l as ServerObject, k as ServerVariableObject, K as TagObject, e as Transform, h as TransformField, f as TransformLevel, g as TransformMap, T as Transformer, V as ValidationSchema, Z as ZodValidator, W as createLogger, X as createLoggerConfig, Y as defaultLogger } from './index-TXVFWos4.mjs';
|
|
3
3
|
import { ObjectId } from 'bson';
|
|
4
4
|
import { z, ZodType } from 'zod/v4';
|
|
5
5
|
import { Ajv2019 } from 'ajv/dist/2019.js';
|
|
@@ -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
|
|
202
|
+
declare function wrapMixin<Settings, Methods, Mixins>(svc: Partial<CustomServiceSchema<Settings, Methods, Mixins>>): typeof svc;
|
|
203
203
|
/**
|
|
204
204
|
* This function is a NO-OP and is only useful for Typescript types.
|
|
205
205
|
* Using Generic arguments allows TS to infer types directly from the object
|
|
@@ -208,7 +208,7 @@ declare function wrapMixin<Settings, Methods, Mixins, AdditionalProperties>(svc:
|
|
|
208
208
|
* For the wrapService fn, it will return a moleculer ServiceSchema that will stripe
|
|
209
209
|
* out every smart typing of methods. This should never be used inside a mixin.
|
|
210
210
|
*/
|
|
211
|
-
declare function wrapService<Settings, Methods, Mixins
|
|
211
|
+
declare function wrapService<Settings, Methods, Mixins>(svc: CustomServiceSchema<Settings, Methods, Mixins>): ServiceSchema;
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
214
|
* This class replace the default Service class in Moleculer to:
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as SCHEMA_REF_NAME, i as isZodSchema, z as zodToOpenAPISchema, o as omitFields, G as GetOpenApiParamsSchema, V as ValidationErrorSchema, F as FileTooBigSchema, a as FileNotExistSchema, U as UnauthorizedErrorSchema, b as ServerErrorSchema, C as COERCE_ARRAY_ATTRIBUTE } from './index-B6AujuxZ.mjs';
|
|
2
2
|
export { D as DATE_TYPE, E as EMPTY_OBJECT_SCHEMA, O as OBJECTID_TYPE, c as addFieldsToSchema, f as composeSchemas, k as createOpenAPIResponses, e as optionalExceptFields, d as optionalFields, p as pickFields, t as toPartialSchema, j as zodCoerceArray, g as zodDate, h as zodObjectId } from './index-B6AujuxZ.mjs';
|
|
3
|
-
import { Ajv2019 } from 'ajv/dist/2019.
|
|
3
|
+
import { Ajv2019 } from 'ajv/dist/2019.ts';
|
|
4
4
|
import { Validators, Errors, Context, ServiceBroker, Service, TracerExporters, MetricReporters } from 'moleculer';
|
|
5
5
|
import addFormats from 'ajv-formats';
|
|
6
6
|
import addKeywords from 'ajv-keywords';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Document, WithoutId, InferIdType, ObjectId, Filter, WithId, OptionalId, FindOptions, CountDocumentsOptions, FindOneAndUpdateOptions, BulkWriteOptions, UpdateOptions, FindOneAndReplaceOptions, FindOneAndDeleteOptions, DeleteOptions, CollationOptions, CreateCollectionOptions, MongoClient, CollectionOptions, Collection, UpdateFilter, FindCursor, UpdateResult } from 'mongodb';
|
|
2
2
|
import { ActionVisibility, BaseValidator, Errors, Context } from 'moleculer';
|
|
3
3
|
import { ZodType, ZodObject } from 'zod/v4';
|
|
4
|
-
import { V as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, a as CustomServiceSchema } from '../index-
|
|
4
|
+
import { V as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
|
|
5
5
|
import { Readable } from 'stream';
|
|
6
6
|
import 'bson';
|
|
7
7
|
import 'ajv/dist/2019.js';
|
|
@@ -503,7 +503,7 @@ declare function DatabaseConnectionMixin<TSchema extends Record<string, unknown>
|
|
|
503
503
|
getFromStore(storeName: string, key: string): MongoClient | null;
|
|
504
504
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
505
505
|
setClientToStore(storeName: string, key: string, client: MongoClient, onClose: () => Promise<void> | void): void;
|
|
506
|
-
}, unknown
|
|
506
|
+
}, unknown>>[]>>;
|
|
507
507
|
|
|
508
508
|
declare const MoleculerClientError: typeof Errors.MoleculerClientError;
|
|
509
509
|
declare class EntityNotFoundError extends MoleculerClientError {
|
|
@@ -800,7 +800,7 @@ declare const DATABASE_INDEXES_MIXIN_SYNC_EVENT = "database-indexes-mixin.sync";
|
|
|
800
800
|
declare function DatabaseIndexesMixin(opts: DatabaseIndexesOptions): Partial<CustomServiceSchema<unknown, {
|
|
801
801
|
_syncIndexes({ dropIndexes, createIndexes, }: SyncIndexesOptions): Promise<void>;
|
|
802
802
|
_createIndexFromState(col: Collection, state: IndexState): Promise<void>;
|
|
803
|
-
}, unknown
|
|
803
|
+
}, unknown>>;
|
|
804
804
|
|
|
805
805
|
declare function getDefaultIndexName(key: Record<string, 1 | -1>): string;
|
|
806
806
|
declare function isIndexNameEqual(dbIdx: MongoIndex, idx: IndexTuple): boolean;
|
|
@@ -937,7 +937,7 @@ declare function DatabaseMethodsMixin<TSchema extends Document & {
|
|
|
937
937
|
* WARNING: Do not send any events. You'll have to send an event yourself.
|
|
938
938
|
*/
|
|
939
939
|
_deleteMany(query: Filter<TSchema>, params: TenantParams<TSchema, TenantField>, options?: DatabaseDeleteManyOptions): Promise<number>;
|
|
940
|
-
}, unknown
|
|
940
|
+
}, unknown>>;
|
|
941
941
|
|
|
942
942
|
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 };
|
|
943
943
|
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, WithoutId, InferIdType, ObjectId, Filter, WithId, OptionalId, FindOptions, CountDocumentsOptions, FindOneAndUpdateOptions, BulkWriteOptions, UpdateOptions, FindOneAndReplaceOptions, FindOneAndDeleteOptions, DeleteOptions, CollationOptions, CreateCollectionOptions, MongoClient, CollectionOptions, Collection, UpdateFilter, FindCursor, UpdateResult } from 'mongodb';
|
|
2
2
|
import { ActionVisibility, BaseValidator, Errors, Context } from 'moleculer';
|
|
3
3
|
import { ZodType, ZodObject } from 'zod/v4';
|
|
4
|
-
import { V as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, a as CustomServiceSchema } from '../index-
|
|
4
|
+
import { V as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
|
|
5
5
|
import { Readable } from 'stream';
|
|
6
6
|
import 'bson';
|
|
7
7
|
import 'ajv/dist/2019.js';
|
|
@@ -503,7 +503,7 @@ declare function DatabaseConnectionMixin<TSchema extends Record<string, unknown>
|
|
|
503
503
|
getFromStore(storeName: string, key: string): MongoClient | null;
|
|
504
504
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
505
505
|
setClientToStore(storeName: string, key: string, client: MongoClient, onClose: () => Promise<void> | void): void;
|
|
506
|
-
}, unknown
|
|
506
|
+
}, unknown>>[]>>;
|
|
507
507
|
|
|
508
508
|
declare const MoleculerClientError: typeof Errors.MoleculerClientError;
|
|
509
509
|
declare class EntityNotFoundError extends MoleculerClientError {
|
|
@@ -800,7 +800,7 @@ declare const DATABASE_INDEXES_MIXIN_SYNC_EVENT = "database-indexes-mixin.sync";
|
|
|
800
800
|
declare function DatabaseIndexesMixin(opts: DatabaseIndexesOptions): Partial<CustomServiceSchema<unknown, {
|
|
801
801
|
_syncIndexes({ dropIndexes, createIndexes, }: SyncIndexesOptions): Promise<void>;
|
|
802
802
|
_createIndexFromState(col: Collection, state: IndexState): Promise<void>;
|
|
803
|
-
}, unknown
|
|
803
|
+
}, unknown>>;
|
|
804
804
|
|
|
805
805
|
declare function getDefaultIndexName(key: Record<string, 1 | -1>): string;
|
|
806
806
|
declare function isIndexNameEqual(dbIdx: MongoIndex, idx: IndexTuple): boolean;
|
|
@@ -937,7 +937,7 @@ declare function DatabaseMethodsMixin<TSchema extends Document & {
|
|
|
937
937
|
* WARNING: Do not send any events. You'll have to send an event yourself.
|
|
938
938
|
*/
|
|
939
939
|
_deleteMany(query: Filter<TSchema>, params: TenantParams<TSchema, TenantField>, options?: DatabaseDeleteManyOptions): Promise<number>;
|
|
940
|
-
}, unknown
|
|
940
|
+
}, unknown>>;
|
|
941
941
|
|
|
942
942
|
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 };
|
|
943
943
|
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 '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
|
|
2
2
|
import { buildClient, NodeCachingMaterialsManager } from '@aws-crypto/client-node';
|
|
3
3
|
import 'moleculer';
|
|
4
4
|
import 'bson';
|
|
@@ -26,7 +26,7 @@ declare function EncryptorMixin({ keyId, cacheMaxMessagesEncrypted, cacheMaxAge,
|
|
|
26
26
|
getEncryptorCmm(): NodeCachingMaterialsManager;
|
|
27
27
|
encrypt(plainData: Buffer | string): Promise<Buffer>;
|
|
28
28
|
decrypt(encryptedData: Uint8Array | string): Promise<Buffer>;
|
|
29
|
-
}, unknown
|
|
29
|
+
}, unknown>>;
|
|
30
30
|
|
|
31
31
|
export { EncryptorMixin, kCmm };
|
|
32
32
|
export type { EncryptorMixinSettings };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
|
|
2
2
|
import { buildClient, NodeCachingMaterialsManager } from '@aws-crypto/client-node';
|
|
3
3
|
import 'moleculer';
|
|
4
4
|
import 'bson';
|
|
@@ -26,7 +26,7 @@ declare function EncryptorMixin({ keyId, cacheMaxMessagesEncrypted, cacheMaxAge,
|
|
|
26
26
|
getEncryptorCmm(): NodeCachingMaterialsManager;
|
|
27
27
|
encrypt(plainData: Buffer | string): Promise<Buffer>;
|
|
28
28
|
decrypt(encryptedData: Uint8Array | string): Promise<Buffer>;
|
|
29
|
-
}, unknown
|
|
29
|
+
}, unknown>>;
|
|
30
30
|
|
|
31
31
|
export { EncryptorMixin, kCmm };
|
|
32
32
|
export type { EncryptorMixinSettings };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
|
|
2
2
|
import 'moleculer';
|
|
3
3
|
import 'bson';
|
|
4
4
|
import 'zod/v4';
|
|
@@ -35,6 +35,6 @@ declare function GlobalStoreMixin<T = unknown>(): Partial<CustomServiceSchema<un
|
|
|
35
35
|
* Set the client in global store.
|
|
36
36
|
*/
|
|
37
37
|
setClientToStore(storeName: string, key: string, client: T, onClose: Wrapper<T>["onClose"]): void;
|
|
38
|
-
}, unknown
|
|
38
|
+
}, unknown>>;
|
|
39
39
|
|
|
40
40
|
export { GlobalStoreMixin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
|
|
2
2
|
import 'moleculer';
|
|
3
3
|
import 'bson';
|
|
4
4
|
import 'zod/v4';
|
|
@@ -35,6 +35,6 @@ declare function GlobalStoreMixin<T = unknown>(): Partial<CustomServiceSchema<un
|
|
|
35
35
|
* Set the client in global store.
|
|
36
36
|
*/
|
|
37
37
|
setClientToStore(storeName: string, key: string, client: T, onClose: Wrapper<T>["onClose"]): void;
|
|
38
|
-
}, unknown
|
|
38
|
+
}, unknown>>;
|
|
39
39
|
|
|
40
40
|
export { GlobalStoreMixin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.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';
|
|
@@ -21,7 +21,7 @@ type JwtSignerMixinSettings = {
|
|
|
21
21
|
};
|
|
22
22
|
declare function JwtSignerMixin(opts: JwtSignerMixinSettings): Partial<CustomServiceSchema<unknown, {
|
|
23
23
|
generateJwt(payload?: string | Buffer | object): Promise<string>;
|
|
24
|
-
}, unknown
|
|
24
|
+
}, unknown>>;
|
|
25
25
|
type JwtVerifierMixinSettings = {
|
|
26
26
|
jwksOptions: Options;
|
|
27
27
|
validClaim: VerifyOptions;
|
|
@@ -38,7 +38,7 @@ declare function JwtVerifierMixin(opts: JwtVerifierMixinSettings): Partial<Custo
|
|
|
38
38
|
*/
|
|
39
39
|
verifyJwt(token: string): Promise<void>;
|
|
40
40
|
verifyAuthorizationHeader(ctx: Context, value: string | undefined): Promise<void>;
|
|
41
|
-
}, unknown
|
|
41
|
+
}, unknown>>;
|
|
42
42
|
|
|
43
43
|
export { JwtSignerMixin, JwtVerifierMixin };
|
|
44
44
|
export type { JwtSignerMixinSettings, JwtVerifierMixinSettings };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.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';
|
|
@@ -21,7 +21,7 @@ type JwtSignerMixinSettings = {
|
|
|
21
21
|
};
|
|
22
22
|
declare function JwtSignerMixin(opts: JwtSignerMixinSettings): Partial<CustomServiceSchema<unknown, {
|
|
23
23
|
generateJwt(payload?: string | Buffer | object): Promise<string>;
|
|
24
|
-
}, unknown
|
|
24
|
+
}, unknown>>;
|
|
25
25
|
type JwtVerifierMixinSettings = {
|
|
26
26
|
jwksOptions: Options;
|
|
27
27
|
validClaim: VerifyOptions;
|
|
@@ -38,7 +38,7 @@ declare function JwtVerifierMixin(opts: JwtVerifierMixinSettings): Partial<Custo
|
|
|
38
38
|
*/
|
|
39
39
|
verifyJwt(token: string): Promise<void>;
|
|
40
40
|
verifyAuthorizationHeader(ctx: Context, value: string | undefined): Promise<void>;
|
|
41
|
-
}, unknown
|
|
41
|
+
}, unknown>>;
|
|
42
42
|
|
|
43
43
|
export { JwtSignerMixin, JwtVerifierMixin };
|
|
44
44
|
export type { JwtSignerMixinSettings, JwtVerifierMixinSettings };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.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';
|
|
@@ -43,7 +43,7 @@ declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnec
|
|
|
43
43
|
getFromStore(storeName: string, key: string): Redis | null;
|
|
44
44
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
45
45
|
setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
|
|
46
|
-
}, unknown
|
|
46
|
+
}, unknown>>[]>>;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* This Mixin add the capability to wait on a job.
|
|
@@ -77,14 +77,14 @@ declare function QueueEventsClient<N extends string>(queueName: N, opts: Without
|
|
|
77
77
|
getFromStore(storeName: string, key: string): Redis | null;
|
|
78
78
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
79
79
|
setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
|
|
80
|
-
}, unknown
|
|
80
|
+
}, unknown>>[]>>;
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* This Mixin add the capability to launch a BullMQ flows.
|
|
84
84
|
*/
|
|
85
85
|
declare function QueueFlowProducerMixin(opts: WithoutConnection<QueueBaseOptions> & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
|
|
86
86
|
getFlowProducer(): FlowProducer;
|
|
87
|
-
}, unknown
|
|
87
|
+
}, unknown>>;
|
|
88
88
|
|
|
89
89
|
type RepeatableJob = {
|
|
90
90
|
name: string;
|
|
@@ -111,7 +111,7 @@ declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJo
|
|
|
111
111
|
getFromStore(storeName: string, key: string): Redis | null;
|
|
112
112
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
113
113
|
setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
|
|
114
|
-
}, unknown
|
|
114
|
+
}, unknown>>[]>>;
|
|
115
115
|
|
|
116
116
|
type JobMeta = {
|
|
117
117
|
job?: Job;
|
|
@@ -145,7 +145,7 @@ declare function QueueWorker(queueName: string, opts: WithoutConnection<WorkerOp
|
|
|
145
145
|
getWorker(): Worker;
|
|
146
146
|
processJob(job: Job, token?: string): Promise<any>;
|
|
147
147
|
_processJob(job: Job, token?: string): Promise<any>;
|
|
148
|
-
}, unknown
|
|
148
|
+
}, unknown>>;
|
|
149
149
|
|
|
150
150
|
export { QueueClient, QueueEventsClient, QueueFlowProducerMixin, QueueStaticRepeatableJobs, QueueWorker };
|
|
151
151
|
export type { JobMeta, JobProcessorOptions, QueueMixinOptions, QueueStaticRepeatableJobsOptions, RepeatableJob };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.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';
|
|
@@ -43,7 +43,7 @@ declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnec
|
|
|
43
43
|
getFromStore(storeName: string, key: string): Redis | null;
|
|
44
44
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
45
45
|
setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
|
|
46
|
-
}, unknown
|
|
46
|
+
}, unknown>>[]>>;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* This Mixin add the capability to wait on a job.
|
|
@@ -77,14 +77,14 @@ declare function QueueEventsClient<N extends string>(queueName: N, opts: Without
|
|
|
77
77
|
getFromStore(storeName: string, key: string): Redis | null;
|
|
78
78
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
79
79
|
setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
|
|
80
|
-
}, unknown
|
|
80
|
+
}, unknown>>[]>>;
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* This Mixin add the capability to launch a BullMQ flows.
|
|
84
84
|
*/
|
|
85
85
|
declare function QueueFlowProducerMixin(opts: WithoutConnection<QueueBaseOptions> & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
|
|
86
86
|
getFlowProducer(): FlowProducer;
|
|
87
|
-
}, unknown
|
|
87
|
+
}, unknown>>;
|
|
88
88
|
|
|
89
89
|
type RepeatableJob = {
|
|
90
90
|
name: string;
|
|
@@ -111,7 +111,7 @@ declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJo
|
|
|
111
111
|
getFromStore(storeName: string, key: string): Redis | null;
|
|
112
112
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
113
113
|
setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
|
|
114
|
-
}, unknown
|
|
114
|
+
}, unknown>>[]>>;
|
|
115
115
|
|
|
116
116
|
type JobMeta = {
|
|
117
117
|
job?: Job;
|
|
@@ -145,7 +145,7 @@ declare function QueueWorker(queueName: string, opts: WithoutConnection<WorkerOp
|
|
|
145
145
|
getWorker(): Worker;
|
|
146
146
|
processJob(job: Job, token?: string): Promise<any>;
|
|
147
147
|
_processJob(job: Job, token?: string): Promise<any>;
|
|
148
|
-
}, unknown
|
|
148
|
+
}, unknown>>;
|
|
149
149
|
|
|
150
150
|
export { QueueClient, QueueEventsClient, QueueFlowProducerMixin, QueueStaticRepeatableJobs, QueueWorker };
|
|
151
151
|
export type { JobMeta, JobProcessorOptions, QueueMixinOptions, QueueStaticRepeatableJobsOptions, RepeatableJob };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
|
|
2
2
|
import { RedisOptions, Redis } from 'ioredis';
|
|
3
3
|
import { Service } from 'moleculer';
|
|
4
4
|
import 'bson';
|
|
@@ -22,7 +22,7 @@ declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }
|
|
|
22
22
|
getFromStore(storeName: string, key: string): Redis | null;
|
|
23
23
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
24
24
|
setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
|
|
25
|
-
}, unknown
|
|
25
|
+
}, unknown>>[]>>;
|
|
26
26
|
|
|
27
27
|
export { RedisMixin };
|
|
28
28
|
export type { RedisMixinOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
|
|
2
2
|
import { RedisOptions, Redis } from 'ioredis';
|
|
3
3
|
import { Service } from 'moleculer';
|
|
4
4
|
import 'bson';
|
|
@@ -22,7 +22,7 @@ declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }
|
|
|
22
22
|
getFromStore(storeName: string, key: string): Redis | null;
|
|
23
23
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
24
24
|
setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
|
|
25
|
-
}, unknown
|
|
25
|
+
}, unknown>>[]>>;
|
|
26
26
|
|
|
27
27
|
export { RedisMixin };
|
|
28
28
|
export type { RedisMixinOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
|
|
2
2
|
import { Service } from 'moleculer';
|
|
3
3
|
import { RedisOptions, Redis } from 'ioredis';
|
|
4
4
|
import Redlock from 'redlock';
|
|
@@ -25,7 +25,7 @@ declare function RedlockMixin(options: AllowedOptions, { reuseClient, redLockOpt
|
|
|
25
25
|
getFromStore(storeName: string, key: string): Redis | null;
|
|
26
26
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
27
27
|
setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
|
|
28
|
-
}, unknown
|
|
28
|
+
}, unknown>>[]>>;
|
|
29
29
|
|
|
30
30
|
export { RedlockMixin };
|
|
31
31
|
export type { RedlockMixinOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomServiceSchema } from '../index-
|
|
1
|
+
import { a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
|
|
2
2
|
import { Service } from 'moleculer';
|
|
3
3
|
import { RedisOptions, Redis } from 'ioredis';
|
|
4
4
|
import Redlock from 'redlock';
|
|
@@ -25,7 +25,7 @@ declare function RedlockMixin(options: AllowedOptions, { reuseClient, redLockOpt
|
|
|
25
25
|
getFromStore(storeName: string, key: string): Redis | null;
|
|
26
26
|
removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
|
|
27
27
|
setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
|
|
28
|
-
}, unknown
|
|
28
|
+
}, unknown>>[]>>;
|
|
29
29
|
|
|
30
30
|
export { RedlockMixin };
|
|
31
31
|
export type { RedlockMixinOptions };
|
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": "1.
|
|
9
|
+
"version": "1.3.0",
|
|
10
10
|
"main": "./dist/index.cjs",
|
|
11
11
|
"module": "./dist/index.mjs",
|
|
12
12
|
"types": "./dist/index.d.cts",
|
|
@@ -108,9 +108,9 @@
|
|
|
108
108
|
"ajv-keywords": "^5.1.0",
|
|
109
109
|
"bson": "^6.2.0",
|
|
110
110
|
"date-fns": "^2.21.3",
|
|
111
|
-
"es-toolkit": "^1.
|
|
112
|
-
"pino": "^9.
|
|
113
|
-
"pino-pretty": "^13.1.
|
|
111
|
+
"es-toolkit": "^1.42.0",
|
|
112
|
+
"pino": "^9.14.0",
|
|
113
|
+
"pino-pretty": "^13.1.2"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
|
116
116
|
"@aws-crypto/client-node": "^4.2.1",
|
|
@@ -148,33 +148,33 @@
|
|
|
148
148
|
},
|
|
149
149
|
"devDependencies": {
|
|
150
150
|
"@aws-crypto/client-node": "^4.2.1",
|
|
151
|
-
"@eslint/js": "^9.
|
|
152
|
-
"@treatwell/eslint-plugin-moleculer": "^1.1.
|
|
153
|
-
"@tsconfig/node-lts": "^22.0.
|
|
151
|
+
"@eslint/js": "^9.39.1",
|
|
152
|
+
"@treatwell/eslint-plugin-moleculer": "^1.1.2",
|
|
153
|
+
"@tsconfig/node-lts": "^22.0.4",
|
|
154
154
|
"@types/jsonwebtoken": "^9.0.10",
|
|
155
|
-
"@types/node": "^24.
|
|
156
|
-
"@types/redlock": "^4.0.
|
|
155
|
+
"@types/node": "^24.10.1",
|
|
156
|
+
"@types/redlock": "^4.0.8",
|
|
157
157
|
"bullmq": "^5.59.0",
|
|
158
|
-
"eslint": "^9.
|
|
158
|
+
"eslint": "^9.39.1",
|
|
159
159
|
"eslint-config-prettier": "^10.1.8",
|
|
160
160
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
161
161
|
"eslint-plugin-import": "^2.32.0",
|
|
162
162
|
"eslint-plugin-prettier": "^5.5.4",
|
|
163
|
-
"ioredis": "^5.8.
|
|
163
|
+
"ioredis": "^5.8.2",
|
|
164
164
|
"jiti": "^2.6.1",
|
|
165
165
|
"jsonwebtoken": "^9.0.2",
|
|
166
166
|
"jwks-rsa": "^3.2.0",
|
|
167
167
|
"moleculer": "^0.14.35",
|
|
168
|
-
"mongodb": "^6.
|
|
169
|
-
"mongodb-memory-server": "^10.
|
|
170
|
-
"pkgroll": "^2.
|
|
168
|
+
"mongodb": "^6.21.0",
|
|
169
|
+
"mongodb-memory-server": "^10.3.0",
|
|
170
|
+
"pkgroll": "^2.21.3",
|
|
171
171
|
"prettier": "^3.6.2",
|
|
172
172
|
"redlock": "^4.2.0",
|
|
173
|
-
"semantic-release": "^
|
|
173
|
+
"semantic-release": "^25.0.2",
|
|
174
174
|
"typescript": "~5.9.3",
|
|
175
|
-
"typescript-eslint": "^8.
|
|
176
|
-
"vitest": "^
|
|
177
|
-
"zod": "^4.1.
|
|
175
|
+
"typescript-eslint": "^8.48.0",
|
|
176
|
+
"vitest": "^4.0.13",
|
|
177
|
+
"zod": "^4.1.13"
|
|
178
178
|
},
|
|
179
179
|
"files": [
|
|
180
180
|
"dist"
|