@rytass/wms-module-graphql 0.4.0 → 0.6.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.
Files changed (40) hide show
  1. package/README.md +56 -3
  2. package/adapters/event-emitter.d.ts +29 -0
  3. package/adapters/event-emitter.js +41 -0
  4. package/adapters/member-base.d.ts +11 -0
  5. package/adapters/member-base.js +17 -1
  6. package/docs/README.md +3 -0
  7. package/docs/api-reference.md +60 -0
  8. package/docs/events.md +500 -0
  9. package/docs/integration-guide.md +111 -2
  10. package/index.cjs.js +154 -1
  11. package/index.d.ts +2 -0
  12. package/index.js +3 -0
  13. package/lib/events/index.d.ts +5 -0
  14. package/lib/events/operation-result-map.d.ts +77 -0
  15. package/lib/events/typed-maps.d.ts +73 -0
  16. package/lib/events/wms-mutation-event.constants.d.ts +12 -0
  17. package/lib/events/wms-mutation-event.constants.js +4 -0
  18. package/lib/events/wms-mutation-event.decorator.d.ts +15 -0
  19. package/lib/events/wms-mutation-event.decorator.js +20 -0
  20. package/lib/events/wms-mutation.interceptor.d.ts +21 -0
  21. package/lib/events/wms-mutation.interceptor.js +90 -0
  22. package/lib/graphql.module.d.ts +24 -5
  23. package/lib/graphql.module.js +16 -2
  24. package/lib/mutations/allocate-inventory-order.mutation.js +5 -0
  25. package/lib/mutations/hold-inventory-order.mutation.js +5 -0
  26. package/lib/mutations/loader.mutation.js +7 -0
  27. package/lib/mutations/location.mutation.js +4 -0
  28. package/lib/mutations/material.mutation.js +4 -0
  29. package/lib/mutations/merge-batch.mutation.js +3 -0
  30. package/lib/mutations/quality-inspection-order.mutation.js +3 -0
  31. package/lib/mutations/receive-inventory-order.mutation.js +5 -0
  32. package/lib/mutations/reclassify-inventory-order.mutation.js +3 -0
  33. package/lib/mutations/scrape-order.mutation.js +3 -0
  34. package/lib/mutations/ship-inventory-order.mutation.js +6 -0
  35. package/lib/mutations/split-batch.mutation.js +3 -0
  36. package/lib/mutations/transfer-customer-order.mutation.js +5 -0
  37. package/lib/mutations/transfer-order.mutation.js +6 -0
  38. package/lib/mutations/transfer-vendor-order.mutation.js +5 -0
  39. package/lib/mutations/warehouse-map.mutation.js +3 -0
  40. package/package.json +13 -3
@@ -0,0 +1,20 @@
1
+ import { applyDecorators, SetMetadata, UseInterceptors } from '@nestjs/common';
2
+ import { WMS_MUTATION_EVENT_METADATA } from './wms-mutation-event.constants.js';
3
+ import { WmsMutationInterceptor } from './wms-mutation.interceptor.js';
4
+
5
+ /**
6
+ * Declares the operation event for a WMS root mutation and wires the
7
+ * {@link WmsMutationInterceptor} that runs before-hooks (veto) and flushes
8
+ * collected events post-commit. Apply alongside `@WmsOperation` on each mutation.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * @Mutation(() => ShipInventoryOrderDto)
13
+ * @WmsOperation({ resource: 'ship-inventory-order', action: 'ship' })
14
+ * @WmsMutationEvent({ event: 'ship-inventory-order.shipped' })
15
+ * ship(@Args() args: ShipArgs): Promise<boolean> { ... }
16
+ * ```
17
+ */
18
+ const WmsMutationEvent = (config) => applyDecorators(SetMetadata(WMS_MUTATION_EVENT_METADATA, config), UseInterceptors(WmsMutationInterceptor));
19
+
20
+ export { WmsMutationEvent };
@@ -0,0 +1,21 @@
1
+ import { type CallHandler, type ExecutionContext, type NestInterceptor } from '@nestjs/common';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { WmsEventDispatcher, type WmsActorExtractor } from '@rytass/wms-module-core';
4
+ import { type Observable } from 'rxjs';
5
+ /**
6
+ * Wraps each `@WmsMutationEvent` mutation in a dispatch scope:
7
+ * 1. runs the before-hook (throw -> veto, before any transaction);
8
+ * 2. executes the resolver (services collect stock events into the scope);
9
+ * 3. emits the operation event after the handler resolves (post-commit);
10
+ * 4. flushes the whole buffer to after-listeners + emitter bridge.
11
+ *
12
+ * When no hook/listener/bridge is configured it passes through untouched.
13
+ */
14
+ export declare class WmsMutationInterceptor implements NestInterceptor {
15
+ private readonly reflector;
16
+ private readonly dispatcher;
17
+ private readonly actorExtractor;
18
+ constructor(reflector: Reflector, dispatcher: WmsEventDispatcher, actorExtractor?: WmsActorExtractor | null);
19
+ private resolveActor;
20
+ intercept(context: ExecutionContext, next: CallHandler): Promise<Observable<unknown>>;
21
+ }
@@ -0,0 +1,90 @@
1
+ import { __decorate, __param, __metadata } from 'tslib';
2
+ import { Injectable, Optional, Inject } from '@nestjs/common';
3
+ import { Reflector } from '@nestjs/core';
4
+ import { GqlExecutionContext } from '@nestjs/graphql';
5
+ import { WMS_ACTOR_EXTRACTOR, WmsEventDispatcher, runInDispatchScope, collectToScope } from '@rytass/wms-module-core';
6
+ import { firstValueFrom, of } from 'rxjs';
7
+ import { WMS_MUTATION_EVENT_METADATA } from './wms-mutation-event.constants.js';
8
+
9
+ const defaultResolveId = (result, args) => {
10
+ if (result &&
11
+ typeof result === 'object' &&
12
+ 'id' in result &&
13
+ typeof result.id === 'string') {
14
+ return result.id;
15
+ }
16
+ const argId = args['id'];
17
+ return typeof argId === 'string' ? argId : null;
18
+ };
19
+ /**
20
+ * Wraps each `@WmsMutationEvent` mutation in a dispatch scope:
21
+ * 1. runs the before-hook (throw -> veto, before any transaction);
22
+ * 2. executes the resolver (services collect stock events into the scope);
23
+ * 3. emits the operation event after the handler resolves (post-commit);
24
+ * 4. flushes the whole buffer to after-listeners + emitter bridge.
25
+ *
26
+ * When no hook/listener/bridge is configured it passes through untouched.
27
+ */
28
+ let WmsMutationInterceptor = class WmsMutationInterceptor {
29
+ reflector;
30
+ dispatcher;
31
+ actorExtractor;
32
+ constructor(reflector, dispatcher, actorExtractor = null) {
33
+ this.reflector = reflector;
34
+ this.dispatcher = dispatcher;
35
+ this.actorExtractor = actorExtractor;
36
+ }
37
+ resolveActor(context) {
38
+ if (!this.actorExtractor) {
39
+ return null;
40
+ }
41
+ try {
42
+ return this.actorExtractor(context);
43
+ }
44
+ catch {
45
+ // Fail-open on actor resolution: never break a mutation over audit metadata.
46
+ return null;
47
+ }
48
+ }
49
+ async intercept(context, next) {
50
+ const config = this.reflector.get(WMS_MUTATION_EVENT_METADATA, context.getHandler());
51
+ if (!config || !this.dispatcher.isActive()) {
52
+ return next.handle();
53
+ }
54
+ const args = GqlExecutionContext.create(context).getArgs() ??
55
+ {};
56
+ const actor = this.resolveActor(context);
57
+ // Before-hook runs before any DB work; a throw vetoes with zero side effects.
58
+ await this.dispatcher.runBeforeHook({
59
+ event: config.event,
60
+ args,
61
+ executionContext: context,
62
+ actor,
63
+ });
64
+ const { result, events } = await runInDispatchScope(async () => {
65
+ const handlerResult = await firstValueFrom(next.handle());
66
+ const id = config.resolveId
67
+ ? config.resolveId(handlerResult, args)
68
+ : defaultResolveId(handlerResult, args);
69
+ const operationEvent = {
70
+ name: config.event,
71
+ payload: { id, result: handlerResult, args, actor },
72
+ };
73
+ collectToScope(operationEvent);
74
+ return handlerResult;
75
+ });
76
+ if (events) {
77
+ await this.dispatcher.flush(events);
78
+ }
79
+ return of(result);
80
+ }
81
+ };
82
+ WmsMutationInterceptor = __decorate([
83
+ Injectable(),
84
+ __param(2, Optional()),
85
+ __param(2, Inject(WMS_ACTOR_EXTRACTOR)),
86
+ __metadata("design:paramtypes", [Reflector,
87
+ WmsEventDispatcher, Object])
88
+ ], WmsMutationInterceptor);
89
+
90
+ export { WmsMutationInterceptor };
@@ -1,12 +1,31 @@
1
- import { DynamicModule } from '@nestjs/common';
2
- import type { WmsModuleCoreModuleAsyncOptions } from '@rytass/wms-module-core';
1
+ import { DynamicModule, type Provider } from '@nestjs/common';
2
+ import { type WmsActorExtractor, type WmsModuleCoreModuleAsyncOptions } from '@rytass/wms-module-core';
3
3
  import { type WmsAuthModuleOptions } from './auth';
4
+ import { type WmsTypedAfterListenerMap, type WmsTypedBeforeHookMap } from './events';
4
5
  /**
5
6
  * Options for `WmsModuleGraphqlModule.forRootAsync`. Extends the core module
6
- * options with an optional {@link WmsAuthModuleOptions.authChecker}; when the
7
- * checker is omitted the module stays fully permissive (pre-auth behaviour).
7
+ * options with:
8
+ * - {@link WmsAuthModuleOptions.authChecker} — opt-in resolver authorization;
9
+ * - `beforeHooks` (veto) / `afterListeners` (post-commit notify) — the mutation
10
+ * event/hook system, **typed per event** (operation events carry their concrete
11
+ * DTO via {@link WmsTypedAfterListenerMap});
12
+ * - `actorExtractor` — populates `payload.actor` on every event (pass
13
+ * `memberBaseActorExtractor` from the member-base adapter, or your own);
14
+ * - `enrichStockEvents` — when `true`, stock events also carry
15
+ * `materialId/batchId/locationId/loaderId` (inherited from the core options);
16
+ * - `eventEmitterBridge` — pass `wmsEventEmitterBridgeProvider` from
17
+ * `@rytass/wms-module-graphql/adapters/event-emitter` to also fan events out
18
+ * to `@nestjs/event-emitter` (`@OnEvent('wms.<event>')`).
19
+ *
20
+ * Everything is optional; with nothing configured the module behaves exactly as
21
+ * before (no events emitted, fully permissive).
8
22
  */
9
- export type WmsModuleGraphqlModuleAsyncOptions = WmsModuleCoreModuleAsyncOptions & WmsAuthModuleOptions;
23
+ export type WmsModuleGraphqlModuleAsyncOptions = WmsModuleCoreModuleAsyncOptions & WmsAuthModuleOptions & {
24
+ readonly beforeHooks?: WmsTypedBeforeHookMap;
25
+ readonly afterListeners?: WmsTypedAfterListenerMap;
26
+ readonly actorExtractor?: WmsActorExtractor;
27
+ readonly eventEmitterBridge?: Provider;
28
+ };
10
29
  export declare class WmsModuleGraphqlModule {
11
30
  static forRootAsync(options: WmsModuleGraphqlModuleAsyncOptions): DynamicModule;
12
31
  }
@@ -1,11 +1,12 @@
1
1
  import { __decorate } from 'tslib';
2
2
  import { Module } from '@nestjs/common';
3
- import { WmsModuleCoreModule } from '@rytass/wms-module-core';
3
+ import { WmsModuleCoreModule, WMS_EVENT_OPTIONS, WMS_ACTOR_EXTRACTOR, WmsEventDispatcher } from '@rytass/wms-module-core';
4
4
  import './helpers/loader.service.js';
5
5
  import { HelperModule } from './helpers/helper.module.js';
6
6
  import './helpers/query-path.js';
7
7
  import { WmsAuthGuard } from './auth/wms-auth.guard.js';
8
8
  import { WMS_AUTH_OPTIONS } from './auth/wms-auth.types.js';
9
+ import { WmsMutationInterceptor } from './events/wms-mutation.interceptor.js';
9
10
  import { LoaderMutation } from './mutations/loader.mutation.js';
10
11
  import { LoaderQuery } from './queries/loader.query.js';
11
12
  import { MaterialMutation } from './mutations/material.mutation.js';
@@ -110,13 +111,26 @@ const exportDependencies = [
110
111
  ];
111
112
  let WmsModuleGraphqlModule = WmsModuleGraphqlModule_1 = class WmsModuleGraphqlModule {
112
113
  static forRootAsync(options) {
113
- const { authChecker, ...coreOptions } = options;
114
+ const { authChecker, beforeHooks, afterListeners, actorExtractor, eventEmitterBridge, ...coreOptions } = options;
115
+ // coreOptions still carries `enrichStockEvents`, forwarded to the core module.
114
116
  const coreModule = WmsModuleCoreModule.forRootAsync(coreOptions);
115
117
  const authOptions = { authChecker };
118
+ // The typed hook maps are a compile-time refinement of the core maps; at
119
+ // runtime the dispatched payload IS the concrete result type, so handing the
120
+ // refined maps to the (looser) core option contract is sound.
121
+ const eventOptions = {
122
+ beforeHooks: beforeHooks,
123
+ afterListeners: afterListeners,
124
+ };
116
125
  const providers = [
117
126
  ...exportDependencies,
118
127
  WmsAuthGuard,
119
128
  { provide: WMS_AUTH_OPTIONS, useValue: authOptions },
129
+ { provide: WMS_EVENT_OPTIONS, useValue: eventOptions },
130
+ { provide: WMS_ACTOR_EXTRACTOR, useValue: actorExtractor ?? null },
131
+ WmsEventDispatcher,
132
+ WmsMutationInterceptor,
133
+ ...(eventEmitterBridge ? [eventEmitterBridge] : []),
120
134
  ];
121
135
  return {
122
136
  module: WmsModuleGraphqlModule_1,
@@ -7,6 +7,8 @@ import { CreateAllocateInventoryOrderArgs, UpdateAllocateInventoryOrderArgs } fr
7
7
  import { DeallocateOrderArgs } from '../inputs/deallocate-order.args.js';
8
8
  import '../auth/wms-auth.guard.js';
9
9
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
10
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
11
+ import '../events/wms-mutation.interceptor.js';
10
12
 
11
13
  let AllocateInventoryOrderMutation = class AllocateInventoryOrderMutation {
12
14
  allocateInventoryOrderService;
@@ -56,6 +58,7 @@ let AllocateInventoryOrderMutation = class AllocateInventoryOrderMutation {
56
58
  __decorate([
57
59
  Mutation(() => AllocateInventoryOrderDto),
58
60
  WmsOperation({ resource: 'allocate-inventory-order', action: 'create' }),
61
+ WmsMutationEvent({ event: 'allocate-inventory-order.created' }),
59
62
  __param(0, Args()),
60
63
  __metadata("design:type", Function),
61
64
  __metadata("design:paramtypes", [CreateAllocateInventoryOrderArgs]),
@@ -64,6 +67,7 @@ __decorate([
64
67
  __decorate([
65
68
  Mutation(() => AllocateInventoryOrderDto),
66
69
  WmsOperation({ resource: 'allocate-inventory-order', action: 'update' }),
70
+ WmsMutationEvent({ event: 'allocate-inventory-order.updated' }),
67
71
  __param(0, Args()),
68
72
  __metadata("design:type", Function),
69
73
  __metadata("design:paramtypes", [UpdateAllocateInventoryOrderArgs]),
@@ -72,6 +76,7 @@ __decorate([
72
76
  __decorate([
73
77
  Mutation(() => Boolean),
74
78
  WmsOperation({ resource: 'allocate-inventory-order', action: 'deallocate' }),
79
+ WmsMutationEvent({ event: 'allocate-inventory-order.deallocated' }),
75
80
  __param(0, Args('items', { type: () => [DeallocateOrderArgs] })),
76
81
  __metadata("design:type", Function),
77
82
  __metadata("design:paramtypes", [Array]),
@@ -7,6 +7,8 @@ import { CreateHoldInventoryOrderArgs, UpdateHoldInventoryOrderArgs } from '../i
7
7
  import { ReleaseOrderArgs } from '../inputs/release-order.args.js';
8
8
  import '../auth/wms-auth.guard.js';
9
9
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
10
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
11
+ import '../events/wms-mutation.interceptor.js';
10
12
 
11
13
  let HoldInventoryOrderMutation = class HoldInventoryOrderMutation {
12
14
  holdInventoryOrderService;
@@ -56,6 +58,7 @@ let HoldInventoryOrderMutation = class HoldInventoryOrderMutation {
56
58
  __decorate([
57
59
  Mutation(() => HoldInventoryOrderDto),
58
60
  WmsOperation({ resource: 'hold-inventory-order', action: 'create' }),
61
+ WmsMutationEvent({ event: 'hold-inventory-order.created' }),
59
62
  __param(0, Args()),
60
63
  __metadata("design:type", Function),
61
64
  __metadata("design:paramtypes", [CreateHoldInventoryOrderArgs]),
@@ -64,6 +67,7 @@ __decorate([
64
67
  __decorate([
65
68
  Mutation(() => HoldInventoryOrderDto),
66
69
  WmsOperation({ resource: 'hold-inventory-order', action: 'update' }),
70
+ WmsMutationEvent({ event: 'hold-inventory-order.updated' }),
67
71
  __param(0, Args()),
68
72
  __metadata("design:type", Function),
69
73
  __metadata("design:paramtypes", [UpdateHoldInventoryOrderArgs]),
@@ -72,6 +76,7 @@ __decorate([
72
76
  __decorate([
73
77
  Mutation(() => Boolean),
74
78
  WmsOperation({ resource: 'hold-inventory-order', action: 'release' }),
79
+ WmsMutationEvent({ event: 'hold-inventory-order.released' }),
75
80
  __param(0, Args('items', { type: () => [ReleaseOrderArgs] })),
76
81
  __metadata("design:type", Function),
77
82
  __metadata("design:paramtypes", [Array]),
@@ -31,6 +31,8 @@ import { CreateLoaderArgs, CreateLoadersArgs, UpdateLoaderArgs } from '../inputs
31
31
  import { In } from 'typeorm';
32
32
  import '../auth/wms-auth.guard.js';
33
33
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
34
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
35
+ import '../events/wms-mutation.interceptor.js';
34
36
 
35
37
  let LoaderMutation = class LoaderMutation {
36
38
  loaderService;
@@ -67,6 +69,7 @@ let LoaderMutation = class LoaderMutation {
67
69
  __decorate([
68
70
  Mutation(() => [LoaderDto]),
69
71
  WmsOperation({ resource: 'loader', action: 'create' }),
72
+ WmsMutationEvent({ event: 'loader.created' }),
70
73
  __param(0, Args()),
71
74
  __metadata("design:type", Function),
72
75
  __metadata("design:paramtypes", [CreateLoaderArgs]),
@@ -75,6 +78,7 @@ __decorate([
75
78
  __decorate([
76
79
  Mutation(() => [LoaderDto]),
77
80
  WmsOperation({ resource: 'loader', action: 'create' }),
81
+ WmsMutationEvent({ event: 'loader.batch-created' }),
78
82
  __param(0, Args('items', { type: () => [CreateLoadersArgs] })),
79
83
  __metadata("design:type", Function),
80
84
  __metadata("design:paramtypes", [Array]),
@@ -83,6 +87,7 @@ __decorate([
83
87
  __decorate([
84
88
  Mutation(() => LoaderDto),
85
89
  WmsOperation({ resource: 'loader', action: 'update' }),
90
+ WmsMutationEvent({ event: 'loader.updated' }),
86
91
  __param(0, Args()),
87
92
  __metadata("design:type", Function),
88
93
  __metadata("design:paramtypes", [UpdateLoaderArgs]),
@@ -91,6 +96,7 @@ __decorate([
91
96
  __decorate([
92
97
  Mutation(() => LoaderTypeDto),
93
98
  WmsOperation({ resource: 'loader', action: 'create' }),
99
+ WmsMutationEvent({ event: 'loader.type-created' }),
94
100
  __param(0, Args()),
95
101
  __metadata("design:type", Function),
96
102
  __metadata("design:paramtypes", [CreateLoaderTypeArgs]),
@@ -99,6 +105,7 @@ __decorate([
99
105
  __decorate([
100
106
  Mutation(() => LoaderTypeDto),
101
107
  WmsOperation({ resource: 'loader', action: 'update' }),
108
+ WmsMutationEvent({ event: 'loader.type-updated' }),
102
109
  __param(0, Args()),
103
110
  __metadata("design:type", Function),
104
111
  __metadata("design:paramtypes", [UpdateLoaderTypeArgs]),
@@ -6,6 +6,8 @@ import { LocationDto } from '../dto/location.dto.js';
6
6
  import { CreateLocationArgs, UpdateLocationArgs } from '../inputs/create-location.args.js';
7
7
  import '../auth/wms-auth.guard.js';
8
8
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
9
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
10
+ import '../events/wms-mutation.interceptor.js';
9
11
 
10
12
  let LocationMutation = class LocationMutation {
11
13
  locationService;
@@ -22,6 +24,7 @@ let LocationMutation = class LocationMutation {
22
24
  __decorate([
23
25
  Mutation(() => LocationDto),
24
26
  WmsOperation({ resource: 'location', action: 'create' }),
27
+ WmsMutationEvent({ event: 'location.created' }),
25
28
  __param(0, Args()),
26
29
  __metadata("design:type", Function),
27
30
  __metadata("design:paramtypes", [CreateLocationArgs]),
@@ -30,6 +33,7 @@ __decorate([
30
33
  __decorate([
31
34
  Mutation(() => LocationDto),
32
35
  WmsOperation({ resource: 'location', action: 'update' }),
36
+ WmsMutationEvent({ event: 'location.updated' }),
33
37
  __param(0, Args()),
34
38
  __metadata("design:type", Function),
35
39
  __metadata("design:paramtypes", [UpdateLocationArgs]),
@@ -29,6 +29,8 @@ import { CreateMaterialArgs, UpdateMaterialArgs } from '../inputs/create-materia
29
29
  import { MaterialService } from '@rytass/wms-module-core';
30
30
  import '../auth/wms-auth.guard.js';
31
31
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
32
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
33
+ import '../events/wms-mutation.interceptor.js';
32
34
 
33
35
  let MaterialMutation = class MaterialMutation {
34
36
  materialService;
@@ -45,6 +47,7 @@ let MaterialMutation = class MaterialMutation {
45
47
  __decorate([
46
48
  Mutation(() => MaterialDto),
47
49
  WmsOperation({ resource: 'material', action: 'create' }),
50
+ WmsMutationEvent({ event: 'material.created' }),
48
51
  __param(0, Args()),
49
52
  __metadata("design:type", Function),
50
53
  __metadata("design:paramtypes", [CreateMaterialArgs]),
@@ -53,6 +56,7 @@ __decorate([
53
56
  __decorate([
54
57
  Mutation(() => MaterialDto),
55
58
  WmsOperation({ resource: 'material', action: 'update' }),
59
+ WmsMutationEvent({ event: 'material.updated' }),
56
60
  __param(0, Args()),
57
61
  __metadata("design:type", Function),
58
62
  __metadata("design:paramtypes", [UpdateMaterialArgs]),
@@ -6,6 +6,8 @@ import { MergeBatchArgs } from '../inputs/merge-batch.args.js';
6
6
  import { MergeBatchOrderDto } from '../dto/merge-batch-order.dto.js';
7
7
  import '../auth/wms-auth.guard.js';
8
8
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
9
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
10
+ import '../events/wms-mutation.interceptor.js';
9
11
 
10
12
  let MergeBatchMutation = class MergeBatchMutation {
11
13
  stockService;
@@ -32,6 +34,7 @@ let MergeBatchMutation = class MergeBatchMutation {
32
34
  __decorate([
33
35
  Mutation(() => MergeBatchOrderDto),
34
36
  WmsOperation({ resource: 'batch', action: 'merge' }),
37
+ WmsMutationEvent({ event: 'batch.merged' }),
35
38
  __param(0, Args()),
36
39
  __metadata("design:type", Function),
37
40
  __metadata("design:paramtypes", [MergeBatchArgs]),
@@ -6,6 +6,8 @@ import { QualityInspectionOrderDto } from '../dto/quality-inspection-order.dto.j
6
6
  import { CreateQualityInspectionOrderArgs } from '../inputs/create-quality-inspection-order.args.js';
7
7
  import '../auth/wms-auth.guard.js';
8
8
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
9
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
10
+ import '../events/wms-mutation.interceptor.js';
9
11
 
10
12
  let QualityInspectionOrderMutation = class QualityInspectionOrderMutation {
11
13
  qualityInspectionOrderService;
@@ -33,6 +35,7 @@ let QualityInspectionOrderMutation = class QualityInspectionOrderMutation {
33
35
  __decorate([
34
36
  Mutation(() => QualityInspectionOrderDto),
35
37
  WmsOperation({ resource: 'quality-inspection-order', action: 'inspect' }),
38
+ WmsMutationEvent({ event: 'quality-inspection-order.inspected' }),
36
39
  __param(0, Args()),
37
40
  __metadata("design:type", Function),
38
41
  __metadata("design:paramtypes", [CreateQualityInspectionOrderArgs]),
@@ -31,6 +31,8 @@ import { DataSource } from 'typeorm';
31
31
  import { ReceiveOrderArgs } from '../inputs/receive-order.args.js';
32
32
  import '../auth/wms-auth.guard.js';
33
33
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
34
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
35
+ import '../events/wms-mutation.interceptor.js';
34
36
 
35
37
  let ReceiveInventoryOrderMutation = class ReceiveInventoryOrderMutation {
36
38
  dataSource;
@@ -67,6 +69,7 @@ let ReceiveInventoryOrderMutation = class ReceiveInventoryOrderMutation {
67
69
  __decorate([
68
70
  Mutation(() => ReceiveInventoryOrderDto),
69
71
  WmsOperation({ resource: 'receive-inventory-order', action: 'create' }),
72
+ WmsMutationEvent({ event: 'receive-inventory-order.created' }),
70
73
  __param(0, Args()),
71
74
  __metadata("design:type", Function),
72
75
  __metadata("design:paramtypes", [CreateReceiveInventoryOrderArgs]),
@@ -75,6 +78,7 @@ __decorate([
75
78
  __decorate([
76
79
  Mutation(() => ReceiveInventoryOrderDto),
77
80
  WmsOperation({ resource: 'receive-inventory-order', action: 'update' }),
81
+ WmsMutationEvent({ event: 'receive-inventory-order.updated' }),
78
82
  __param(0, Args()),
79
83
  __metadata("design:type", Function),
80
84
  __metadata("design:paramtypes", [UpdateReceiveInventoryOrderArgs]),
@@ -83,6 +87,7 @@ __decorate([
83
87
  __decorate([
84
88
  Mutation(() => Boolean),
85
89
  WmsOperation({ resource: 'receive-inventory-order', action: 'receive' }),
90
+ WmsMutationEvent({ event: 'receive-inventory-order.received' }),
86
91
  __param(0, Args('items', { type: () => [ReceiveOrderArgs] })),
87
92
  __metadata("design:type", Function),
88
93
  __metadata("design:paramtypes", [Array]),
@@ -6,6 +6,8 @@ import { ReclassifyInventoryOrderArgs } from '../inputs/reclassify-inventory-ord
6
6
  import { ReclassifyInventoryOrderDto } from '../dto/reclassify-inventory-order.dto.js';
7
7
  import '../auth/wms-auth.guard.js';
8
8
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
9
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
10
+ import '../events/wms-mutation.interceptor.js';
9
11
 
10
12
  let ReclassifyInventoryOrderMutation = class ReclassifyInventoryOrderMutation {
11
13
  stockService;
@@ -33,6 +35,7 @@ let ReclassifyInventoryOrderMutation = class ReclassifyInventoryOrderMutation {
33
35
  __decorate([
34
36
  Mutation(() => ReclassifyInventoryOrderDto),
35
37
  WmsOperation({ resource: 'reclassify-inventory-order', action: 'reclassify' }),
38
+ WmsMutationEvent({ event: 'reclassify-inventory-order.reclassified' }),
36
39
  __param(0, Args()),
37
40
  __metadata("design:type", Function),
38
41
  __metadata("design:paramtypes", [ReclassifyInventoryOrderArgs]),
@@ -6,6 +6,8 @@ import { ScrapeOrderDto } from '../dto/scrape-order.dto.js';
6
6
  import { ScrapeOrderArgs } from '../inputs/scrape-order.args.js';
7
7
  import '../auth/wms-auth.guard.js';
8
8
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
9
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
10
+ import '../events/wms-mutation.interceptor.js';
9
11
 
10
12
  let ScrapeMutation = class ScrapeMutation {
11
13
  scrapeService;
@@ -27,6 +29,7 @@ let ScrapeMutation = class ScrapeMutation {
27
29
  __decorate([
28
30
  Mutation(() => ScrapeOrderDto),
29
31
  WmsOperation({ resource: 'scrape-order', action: 'scrape' }),
32
+ WmsMutationEvent({ event: 'scrape-order.scraped' }),
30
33
  __param(0, Args()),
31
34
  __metadata("design:type", Function),
32
35
  __metadata("design:paramtypes", [ScrapeOrderArgs]),
@@ -31,6 +31,8 @@ import { ShipOrderArgs } from '../inputs/ship-order.args.js';
31
31
  import { CancelShipOrderArgs } from '../inputs/cancel-ship-order.args.js';
32
32
  import '../auth/wms-auth.guard.js';
33
33
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
34
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
35
+ import '../events/wms-mutation.interceptor.js';
34
36
 
35
37
  let ShipInventoryOrderMutation = class ShipInventoryOrderMutation {
36
38
  shipInventoryOrderService;
@@ -75,6 +77,7 @@ let ShipInventoryOrderMutation = class ShipInventoryOrderMutation {
75
77
  __decorate([
76
78
  Mutation(() => ShipInventoryOrderDto),
77
79
  WmsOperation({ resource: 'ship-inventory-order', action: 'create' }),
80
+ WmsMutationEvent({ event: 'ship-inventory-order.created' }),
78
81
  __param(0, Args()),
79
82
  __metadata("design:type", Function),
80
83
  __metadata("design:paramtypes", [CreateShipInventoryOrderArgs]),
@@ -83,6 +86,7 @@ __decorate([
83
86
  __decorate([
84
87
  Mutation(() => ShipInventoryOrderDto),
85
88
  WmsOperation({ resource: 'ship-inventory-order', action: 'update' }),
89
+ WmsMutationEvent({ event: 'ship-inventory-order.updated' }),
86
90
  __param(0, Args()),
87
91
  __metadata("design:type", Function),
88
92
  __metadata("design:paramtypes", [UpdateShipInventoryOrderArgs]),
@@ -91,6 +95,7 @@ __decorate([
91
95
  __decorate([
92
96
  Mutation(() => Boolean),
93
97
  WmsOperation({ resource: 'ship-inventory-order', action: 'ship' }),
98
+ WmsMutationEvent({ event: 'ship-inventory-order.shipped' }),
94
99
  __param(0, Args('items', { type: () => [ShipOrderArgs] })),
95
100
  __metadata("design:type", Function),
96
101
  __metadata("design:paramtypes", [Array]),
@@ -99,6 +104,7 @@ __decorate([
99
104
  __decorate([
100
105
  Mutation(() => Boolean),
101
106
  WmsOperation({ resource: 'ship-inventory-order', action: 'cancel' }),
107
+ WmsMutationEvent({ event: 'ship-inventory-order.ship-cancelled' }),
102
108
  __param(0, Args('items', { type: () => [CancelShipOrderArgs] })),
103
109
  __metadata("design:type", Function),
104
110
  __metadata("design:paramtypes", [Array]),
@@ -6,6 +6,8 @@ import { SplitBatchArgs } from '../inputs/split-batch.args.js';
6
6
  import { SplitBatchOrderDto } from '../dto/split-batch-order.dto.js';
7
7
  import '../auth/wms-auth.guard.js';
8
8
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
9
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
10
+ import '../events/wms-mutation.interceptor.js';
9
11
 
10
12
  let SplitBatchMutation = class SplitBatchMutation {
11
13
  stockService;
@@ -26,6 +28,7 @@ let SplitBatchMutation = class SplitBatchMutation {
26
28
  __decorate([
27
29
  Mutation(() => SplitBatchOrderDto),
28
30
  WmsOperation({ resource: 'batch', action: 'split' }),
31
+ WmsMutationEvent({ event: 'batch.splitted' }),
29
32
  __param(0, Args()),
30
33
  __metadata("design:type", Function),
31
34
  __metadata("design:paramtypes", [SplitBatchArgs]),
@@ -7,6 +7,8 @@ import { CreateTransferCustomerOrderArgs, UpdateTransferCustomerOrderArgs } from
7
7
  import { ReturnTransferCustomerOrderArgs } from '../inputs/return-transfer-customer-order.args.js';
8
8
  import '../auth/wms-auth.guard.js';
9
9
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
10
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
11
+ import '../events/wms-mutation.interceptor.js';
10
12
 
11
13
  let TransferCustomerOrderMutation = class TransferCustomerOrderMutation {
12
14
  transferCustomerOrderService;
@@ -56,6 +58,7 @@ let TransferCustomerOrderMutation = class TransferCustomerOrderMutation {
56
58
  __decorate([
57
59
  Mutation(() => TransferCustomerOrderDto),
58
60
  WmsOperation({ resource: 'transfer-customer-order', action: 'create' }),
61
+ WmsMutationEvent({ event: 'transfer-customer-order.created' }),
59
62
  __param(0, Args()),
60
63
  __metadata("design:type", Function),
61
64
  __metadata("design:paramtypes", [CreateTransferCustomerOrderArgs]),
@@ -64,6 +67,7 @@ __decorate([
64
67
  __decorate([
65
68
  Mutation(() => TransferCustomerOrderDto),
66
69
  WmsOperation({ resource: 'transfer-customer-order', action: 'update' }),
70
+ WmsMutationEvent({ event: 'transfer-customer-order.updated' }),
67
71
  __param(0, Args()),
68
72
  __metadata("design:type", Function),
69
73
  __metadata("design:paramtypes", [UpdateTransferCustomerOrderArgs]),
@@ -72,6 +76,7 @@ __decorate([
72
76
  __decorate([
73
77
  Mutation(() => Boolean),
74
78
  WmsOperation({ resource: 'transfer-customer-order', action: 'return' }),
79
+ WmsMutationEvent({ event: 'transfer-customer-order.returned' }),
75
80
  __param(0, Args('items', { type: () => [ReturnTransferCustomerOrderArgs] })),
76
81
  __metadata("design:type", Function),
77
82
  __metadata("design:paramtypes", [Array]),
@@ -8,6 +8,8 @@ import { TransferOrderArgs } from '../inputs/transfer-order.args.js';
8
8
  import { CancelTransferOrderArgs } from '../inputs/cancel-transfer-order.args.js';
9
9
  import '../auth/wms-auth.guard.js';
10
10
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
11
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
12
+ import '../events/wms-mutation.interceptor.js';
11
13
 
12
14
  let TransferOrderMutation = class TransferOrderMutation {
13
15
  transferOrderService;
@@ -52,6 +54,7 @@ let TransferOrderMutation = class TransferOrderMutation {
52
54
  __decorate([
53
55
  Mutation(() => TransferOrderDto),
54
56
  WmsOperation({ resource: 'transfer-order', action: 'create' }),
57
+ WmsMutationEvent({ event: 'transfer-order.created' }),
55
58
  __param(0, Args()),
56
59
  __metadata("design:type", Function),
57
60
  __metadata("design:paramtypes", [CreateTransferOrderArgs]),
@@ -60,6 +63,7 @@ __decorate([
60
63
  __decorate([
61
64
  Mutation(() => TransferOrderDto),
62
65
  WmsOperation({ resource: 'transfer-order', action: 'update' }),
66
+ WmsMutationEvent({ event: 'transfer-order.updated' }),
63
67
  __param(0, Args()),
64
68
  __metadata("design:type", Function),
65
69
  __metadata("design:paramtypes", [UpdateTransferOrderArgs]),
@@ -68,6 +72,7 @@ __decorate([
68
72
  __decorate([
69
73
  Mutation(() => Boolean),
70
74
  WmsOperation({ resource: 'transfer-order', action: 'transfer' }),
75
+ WmsMutationEvent({ event: 'transfer-order.transferred' }),
71
76
  __param(0, Args('items', { type: () => [TransferOrderArgs] })),
72
77
  __metadata("design:type", Function),
73
78
  __metadata("design:paramtypes", [Array]),
@@ -76,6 +81,7 @@ __decorate([
76
81
  __decorate([
77
82
  Mutation(() => Boolean),
78
83
  WmsOperation({ resource: 'transfer-order', action: 'cancel' }),
84
+ WmsMutationEvent({ event: 'transfer-order.transfer-cancelled' }),
79
85
  __param(0, Args('items', { type: () => [CancelTransferOrderArgs] })),
80
86
  __metadata("design:type", Function),
81
87
  __metadata("design:paramtypes", [Array]),
@@ -7,6 +7,8 @@ import { CreateTransferVendorOrderArgs, UpdateTransferVendorOrderArgs } from '..
7
7
  import { ReturnTransferVendorOrderArgs } from '../inputs/return-transfer-vendor-order.args.js';
8
8
  import '../auth/wms-auth.guard.js';
9
9
  import { WmsOperation } from '../auth/wms-operation.decorator.js';
10
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
11
+ import '../events/wms-mutation.interceptor.js';
10
12
 
11
13
  let TransferVendorOrderMutation = class TransferVendorOrderMutation {
12
14
  transferVendorOrderService;
@@ -56,6 +58,7 @@ let TransferVendorOrderMutation = class TransferVendorOrderMutation {
56
58
  __decorate([
57
59
  Mutation(() => TransferVendorOrderDto),
58
60
  WmsOperation({ resource: 'transfer-vendor-order', action: 'create' }),
61
+ WmsMutationEvent({ event: 'transfer-vendor-order.created' }),
59
62
  __param(0, Args()),
60
63
  __metadata("design:type", Function),
61
64
  __metadata("design:paramtypes", [CreateTransferVendorOrderArgs]),
@@ -64,6 +67,7 @@ __decorate([
64
67
  __decorate([
65
68
  Mutation(() => TransferVendorOrderDto),
66
69
  WmsOperation({ resource: 'transfer-vendor-order', action: 'update' }),
70
+ WmsMutationEvent({ event: 'transfer-vendor-order.updated' }),
67
71
  __param(0, Args()),
68
72
  __metadata("design:type", Function),
69
73
  __metadata("design:paramtypes", [UpdateTransferVendorOrderArgs]),
@@ -72,6 +76,7 @@ __decorate([
72
76
  __decorate([
73
77
  Mutation(() => Boolean),
74
78
  WmsOperation({ resource: 'transfer-vendor-order', action: 'return' }),
79
+ WmsMutationEvent({ event: 'transfer-vendor-order.returned' }),
75
80
  __param(0, Args('items', { type: () => [ReturnTransferVendorOrderArgs] })),
76
81
  __metadata("design:type", Function),
77
82
  __metadata("design:paramtypes", [Array]),