@rytass/wms-module-graphql 0.3.0 → 0.4.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 (51) hide show
  1. package/README.md +28 -0
  2. package/adapters/member-base.d.ts +35 -0
  3. package/adapters/member-base.js +47 -0
  4. package/docs/README.md +3 -0
  5. package/docs/api-reference.md +60 -1
  6. package/docs/authorization.md +349 -0
  7. package/docs/integration-guide.md +38 -2
  8. package/index.cjs.js +172 -3
  9. package/index.d.ts +2 -0
  10. package/index.js +4 -0
  11. package/lib/auth/host-skip.constant.d.ts +27 -0
  12. package/lib/auth/host-skip.constant.js +29 -0
  13. package/lib/auth/index.d.ts +4 -0
  14. package/lib/auth/wms-auth.guard.d.ts +19 -0
  15. package/lib/auth/wms-auth.guard.js +41 -0
  16. package/lib/auth/wms-auth.types.d.ts +36 -0
  17. package/lib/auth/wms-auth.types.js +6 -0
  18. package/lib/auth/wms-operation.decorator.d.ts +23 -0
  19. package/lib/auth/wms-operation.decorator.js +29 -0
  20. package/lib/graphql.module.d.ts +8 -1
  21. package/lib/graphql.module.js +12 -3
  22. package/lib/mutations/allocate-inventory-order.mutation.js +5 -0
  23. package/lib/mutations/hold-inventory-order.mutation.js +5 -0
  24. package/lib/mutations/loader.mutation.js +7 -0
  25. package/lib/mutations/location.mutation.js +4 -0
  26. package/lib/mutations/material.mutation.js +4 -0
  27. package/lib/mutations/merge-batch.mutation.js +3 -0
  28. package/lib/mutations/quality-inspection-order.mutation.js +3 -0
  29. package/lib/mutations/receive-inventory-order.mutation.js +5 -0
  30. package/lib/mutations/reclassify-inventory-order.mutation.js +3 -0
  31. package/lib/mutations/scrape-order.mutation.js +3 -0
  32. package/lib/mutations/ship-inventory-order.mutation.js +6 -0
  33. package/lib/mutations/split-batch.mutation.js +3 -0
  34. package/lib/mutations/transfer-customer-order.mutation.js +5 -0
  35. package/lib/mutations/transfer-order.mutation.js +6 -0
  36. package/lib/mutations/transfer-vendor-order.mutation.js +5 -0
  37. package/lib/mutations/warehouse-map.mutation.js +3 -0
  38. package/lib/queries/allocate-inventory-order.query.js +3 -0
  39. package/lib/queries/batch.query.js +3 -0
  40. package/lib/queries/hold-inventory-order.query.js +3 -0
  41. package/lib/queries/loader.query.js +8 -0
  42. package/lib/queries/location.query.js +4 -0
  43. package/lib/queries/material.query.js +4 -0
  44. package/lib/queries/recieve-inventory-order.query.js +4 -0
  45. package/lib/queries/sale-order.query.js +4 -0
  46. package/lib/queries/ship-inventory-order.query.js +4 -0
  47. package/lib/queries/stock.query.js +7 -0
  48. package/lib/queries/transfer-order.query.js +4 -0
  49. package/lib/queries/unit.query.js +3 -0
  50. package/lib/queries/warehouse-map.query.js +3 -0
  51. package/package.json +5 -1
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Metadata key stamped on every `@WmsOperation` handler so that a host
3
+ * application's *globally registered* auth guard (`APP_GUARD`) treats WMS
4
+ * resolvers as "skip / public" and defers the real authorization decision to
5
+ * {@link WmsAuthGuard}.
6
+ *
7
+ * Why this exists
8
+ * ---------------
9
+ * A deny-by-default global guard — e.g. the `CasbinGuard` from
10
+ * `@rytass/member-base-nestjs-module` — blankets every resolver in the compiled
11
+ * schema, including the ones this library owns. WMS resolvers carry no
12
+ * host-specific permission metadata, so such a guard rejects them all. By
13
+ * stamping this key WMS tells the host guard "let me through", and then runs
14
+ * its own {@link WmsAuthGuard} (wired to the consumer's `authChecker`) to do the
15
+ * actual enforcement.
16
+ *
17
+ * The single coupling point
18
+ * -------------------------
19
+ * The default value matches `@rytass/member-base-nestjs-module`'s
20
+ * `IS_ROUTE_PUBLIC` metadata key. This is the *one and only* place WMS assumes
21
+ * anything about a specific host guard. If your host guard uses a different
22
+ * "public / skip" metadata key, fork this constant — nothing else changes.
23
+ *
24
+ * If you do not register a global guard at all (or set
25
+ * `enableGlobalGuard: false`), this marker is simply inert.
26
+ */
27
+ export declare const HOST_SKIP_METADATA_KEY = "IS_ROUTE_PUBLIC";
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Metadata key stamped on every `@WmsOperation` handler so that a host
3
+ * application's *globally registered* auth guard (`APP_GUARD`) treats WMS
4
+ * resolvers as "skip / public" and defers the real authorization decision to
5
+ * {@link WmsAuthGuard}.
6
+ *
7
+ * Why this exists
8
+ * ---------------
9
+ * A deny-by-default global guard — e.g. the `CasbinGuard` from
10
+ * `@rytass/member-base-nestjs-module` — blankets every resolver in the compiled
11
+ * schema, including the ones this library owns. WMS resolvers carry no
12
+ * host-specific permission metadata, so such a guard rejects them all. By
13
+ * stamping this key WMS tells the host guard "let me through", and then runs
14
+ * its own {@link WmsAuthGuard} (wired to the consumer's `authChecker`) to do the
15
+ * actual enforcement.
16
+ *
17
+ * The single coupling point
18
+ * -------------------------
19
+ * The default value matches `@rytass/member-base-nestjs-module`'s
20
+ * `IS_ROUTE_PUBLIC` metadata key. This is the *one and only* place WMS assumes
21
+ * anything about a specific host guard. If your host guard uses a different
22
+ * "public / skip" metadata key, fork this constant — nothing else changes.
23
+ *
24
+ * If you do not register a global guard at all (or set
25
+ * `enableGlobalGuard: false`), this marker is simply inert.
26
+ */
27
+ const HOST_SKIP_METADATA_KEY = 'IS_ROUTE_PUBLIC';
28
+
29
+ export { HOST_SKIP_METADATA_KEY };
@@ -0,0 +1,4 @@
1
+ export { HOST_SKIP_METADATA_KEY } from './host-skip.constant';
2
+ export { WmsAuthGuard } from './wms-auth.guard';
3
+ export { WmsOperation } from './wms-operation.decorator';
4
+ export { WMS_AUTH_OPTIONS, WMS_OPERATION_METADATA, type WmsAuthChecker, type WmsAuthModuleOptions, type WmsOperationRequirement, } from './wms-auth.types';
@@ -0,0 +1,19 @@
1
+ import { type CanActivate, type ExecutionContext } from '@nestjs/common';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { type WmsAuthModuleOptions } from './wms-auth.types';
4
+ /**
5
+ * Route-level guard applied automatically by `@WmsOperation`. It reads the
6
+ * requirement declared on the handler and delegates the allow/deny decision to
7
+ * the consumer-supplied {@link WmsAuthModuleOptions.authChecker}.
8
+ *
9
+ * It is deliberately permissive in two cases:
10
+ * - the handler carries no requirement (field resolvers reached only through an
11
+ * already-authorized root operation), and
12
+ * - no `authChecker` was configured (local dev / auth handled elsewhere).
13
+ */
14
+ export declare class WmsAuthGuard implements CanActivate {
15
+ private readonly reflector;
16
+ private readonly options;
17
+ constructor(reflector: Reflector, options: WmsAuthModuleOptions);
18
+ canActivate(context: ExecutionContext): boolean | Promise<boolean>;
19
+ }
@@ -0,0 +1,41 @@
1
+ import { __decorate, __param, __metadata } from 'tslib';
2
+ import { Injectable, Inject } from '@nestjs/common';
3
+ import { Reflector } from '@nestjs/core';
4
+ import { WMS_AUTH_OPTIONS, WMS_OPERATION_METADATA } from './wms-auth.types.js';
5
+
6
+ /**
7
+ * Route-level guard applied automatically by `@WmsOperation`. It reads the
8
+ * requirement declared on the handler and delegates the allow/deny decision to
9
+ * the consumer-supplied {@link WmsAuthModuleOptions.authChecker}.
10
+ *
11
+ * It is deliberately permissive in two cases:
12
+ * - the handler carries no requirement (field resolvers reached only through an
13
+ * already-authorized root operation), and
14
+ * - no `authChecker` was configured (local dev / auth handled elsewhere).
15
+ */
16
+ let WmsAuthGuard = class WmsAuthGuard {
17
+ reflector;
18
+ options;
19
+ constructor(reflector, options) {
20
+ this.reflector = reflector;
21
+ this.options = options;
22
+ }
23
+ canActivate(context) {
24
+ const requirement = this.reflector.get(WMS_OPERATION_METADATA, context.getHandler());
25
+ if (!requirement) {
26
+ return true;
27
+ }
28
+ const { authChecker } = this.options;
29
+ if (!authChecker) {
30
+ return true;
31
+ }
32
+ return authChecker(context, requirement);
33
+ }
34
+ };
35
+ WmsAuthGuard = __decorate([
36
+ Injectable(),
37
+ __param(1, Inject(WMS_AUTH_OPTIONS)),
38
+ __metadata("design:paramtypes", [Reflector, Object])
39
+ ], WmsAuthGuard);
40
+
41
+ export { WmsAuthGuard };
@@ -0,0 +1,36 @@
1
+ import type { ExecutionContext } from '@nestjs/common';
2
+ /**
3
+ * A single, host-neutral permission requirement attached to a WMS root
4
+ * operation. `resource` and `action` are plain strings on purpose — the WMS
5
+ * library never knows (nor cares) how a consumer maps them onto Casbin, RBAC
6
+ * tiers, JWT scopes or anything else. The mapping lives entirely in the
7
+ * consumer-supplied {@link WmsAuthChecker}.
8
+ */
9
+ export interface WmsOperationRequirement {
10
+ readonly resource: string;
11
+ readonly action: string;
12
+ }
13
+ /**
14
+ * The authorization contract a consumer wires into
15
+ * `WmsModuleGraphqlModule.forRootAsync({ authChecker })`. It receives the live
16
+ * NestJS {@link ExecutionContext} (so the consumer can reach the request,
17
+ * GraphQL context, current member, enforcer, etc.) plus the requirement
18
+ * declared by `@WmsOperation` on the resolver being invoked.
19
+ *
20
+ * Return `true` to allow, `false` to deny. Throwing is also fine — the
21
+ * exception propagates exactly like any guard rejection.
22
+ */
23
+ export type WmsAuthChecker = (context: ExecutionContext, requirement: WmsOperationRequirement) => boolean | Promise<boolean>;
24
+ /**
25
+ * Options accepted by `WmsModuleGraphqlModule.forRootAsync` that govern
26
+ * authorization. Intentionally optional: when `authChecker` is omitted the
27
+ * module stays fully permissive, preserving the pre-auth release behaviour for
28
+ * local development and consumers that handle authorization elsewhere.
29
+ */
30
+ export interface WmsAuthModuleOptions {
31
+ readonly authChecker?: WmsAuthChecker;
32
+ }
33
+ /** DI token holding the resolved {@link WmsAuthModuleOptions}. */
34
+ export declare const WMS_AUTH_OPTIONS: unique symbol;
35
+ /** Reflector metadata key carrying the {@link WmsOperationRequirement}. */
36
+ export declare const WMS_OPERATION_METADATA = "wms:operation";
@@ -0,0 +1,6 @@
1
+ /** DI token holding the resolved {@link WmsAuthModuleOptions}. */
2
+ const WMS_AUTH_OPTIONS = Symbol('WMS_AUTH_OPTIONS');
3
+ /** Reflector metadata key carrying the {@link WmsOperationRequirement}. */
4
+ const WMS_OPERATION_METADATA = 'wms:operation';
5
+
6
+ export { WMS_AUTH_OPTIONS, WMS_OPERATION_METADATA };
@@ -0,0 +1,23 @@
1
+ import { type WmsOperationRequirement } from './wms-auth.types';
2
+ /**
3
+ * Declares the permission requirement for a WMS root operation and wires up its
4
+ * enforcement. Apply it to every `@Query` / `@Mutation` the library exposes.
5
+ *
6
+ * It bundles three concerns so a single annotation keeps a resolver
7
+ * self-protecting and host-friendly:
8
+ *
9
+ * 1. {@link WMS_OPERATION_METADATA} — the host-neutral `{ resource, action }`
10
+ * that {@link WmsAuthGuard} hands to the consumer's `authChecker`.
11
+ * 2. {@link HOST_SKIP_METADATA_KEY} — tells a host's global guard to defer (see
12
+ * that constant for the single coupling point with member-base).
13
+ * 3. `@UseGuards(WmsAuthGuard)` — the route-level guard that performs the real
14
+ * authorization through the configured `authChecker`.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * @Query(() => MaterialDto)
19
+ * @WmsOperation({ resource: 'material', action: 'read' })
20
+ * material(@Args('id') id: string): Promise<MaterialDto> { ... }
21
+ * ```
22
+ */
23
+ export declare const WmsOperation: (requirement: WmsOperationRequirement) => MethodDecorator;
@@ -0,0 +1,29 @@
1
+ import { applyDecorators, SetMetadata, UseGuards } from '@nestjs/common';
2
+ import { HOST_SKIP_METADATA_KEY } from './host-skip.constant.js';
3
+ import { WmsAuthGuard } from './wms-auth.guard.js';
4
+ import { WMS_OPERATION_METADATA } from './wms-auth.types.js';
5
+
6
+ /**
7
+ * Declares the permission requirement for a WMS root operation and wires up its
8
+ * enforcement. Apply it to every `@Query` / `@Mutation` the library exposes.
9
+ *
10
+ * It bundles three concerns so a single annotation keeps a resolver
11
+ * self-protecting and host-friendly:
12
+ *
13
+ * 1. {@link WMS_OPERATION_METADATA} — the host-neutral `{ resource, action }`
14
+ * that {@link WmsAuthGuard} hands to the consumer's `authChecker`.
15
+ * 2. {@link HOST_SKIP_METADATA_KEY} — tells a host's global guard to defer (see
16
+ * that constant for the single coupling point with member-base).
17
+ * 3. `@UseGuards(WmsAuthGuard)` — the route-level guard that performs the real
18
+ * authorization through the configured `authChecker`.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * @Query(() => MaterialDto)
23
+ * @WmsOperation({ resource: 'material', action: 'read' })
24
+ * material(@Args('id') id: string): Promise<MaterialDto> { ... }
25
+ * ```
26
+ */
27
+ const WmsOperation = (requirement) => applyDecorators(SetMetadata(WMS_OPERATION_METADATA, requirement), SetMetadata(HOST_SKIP_METADATA_KEY, true), UseGuards(WmsAuthGuard));
28
+
29
+ export { WmsOperation };
@@ -1,5 +1,12 @@
1
1
  import { DynamicModule } from '@nestjs/common';
2
2
  import type { WmsModuleCoreModuleAsyncOptions } from '@rytass/wms-module-core';
3
+ import { type WmsAuthModuleOptions } from './auth';
4
+ /**
5
+ * 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).
8
+ */
9
+ export type WmsModuleGraphqlModuleAsyncOptions = WmsModuleCoreModuleAsyncOptions & WmsAuthModuleOptions;
3
10
  export declare class WmsModuleGraphqlModule {
4
- static forRootAsync(options: WmsModuleCoreModuleAsyncOptions): DynamicModule;
11
+ static forRootAsync(options: WmsModuleGraphqlModuleAsyncOptions): DynamicModule;
5
12
  }
@@ -4,6 +4,8 @@ import { WmsModuleCoreModule } 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
+ import { WmsAuthGuard } from './auth/wms-auth.guard.js';
8
+ import { WMS_AUTH_OPTIONS } from './auth/wms-auth.types.js';
7
9
  import { LoaderMutation } from './mutations/loader.mutation.js';
8
10
  import { LoaderQuery } from './queries/loader.query.js';
9
11
  import { MaterialMutation } from './mutations/material.mutation.js';
@@ -108,12 +110,19 @@ const exportDependencies = [
108
110
  ];
109
111
  let WmsModuleGraphqlModule = WmsModuleGraphqlModule_1 = class WmsModuleGraphqlModule {
110
112
  static forRootAsync(options) {
111
- const coreModule = WmsModuleCoreModule.forRootAsync(options);
113
+ const { authChecker, ...coreOptions } = options;
114
+ const coreModule = WmsModuleCoreModule.forRootAsync(coreOptions);
115
+ const authOptions = { authChecker };
116
+ const providers = [
117
+ ...exportDependencies,
118
+ WmsAuthGuard,
119
+ { provide: WMS_AUTH_OPTIONS, useValue: authOptions },
120
+ ];
112
121
  return {
113
122
  module: WmsModuleGraphqlModule_1,
114
123
  imports: [coreModule, HelperModule],
115
- providers: exportDependencies,
116
- exports: [...exportDependencies, HelperModule, coreModule],
124
+ providers,
125
+ exports: [...exportDependencies, WmsAuthGuard, HelperModule, coreModule],
117
126
  };
118
127
  }
119
128
  };
@@ -5,6 +5,8 @@ import { AllocateInventoryOrderService, StockService } from '@rytass/wms-module-
5
5
  import { AllocateInventoryOrderDto } from '../dto/allocate-inventory-order.dto.js';
6
6
  import { CreateAllocateInventoryOrderArgs, UpdateAllocateInventoryOrderArgs } from '../inputs/create-allocate-inventory-order.args.js';
7
7
  import { DeallocateOrderArgs } from '../inputs/deallocate-order.args.js';
8
+ import '../auth/wms-auth.guard.js';
9
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
8
10
 
9
11
  let AllocateInventoryOrderMutation = class AllocateInventoryOrderMutation {
10
12
  allocateInventoryOrderService;
@@ -53,6 +55,7 @@ let AllocateInventoryOrderMutation = class AllocateInventoryOrderMutation {
53
55
  };
54
56
  __decorate([
55
57
  Mutation(() => AllocateInventoryOrderDto),
58
+ WmsOperation({ resource: 'allocate-inventory-order', action: 'create' }),
56
59
  __param(0, Args()),
57
60
  __metadata("design:type", Function),
58
61
  __metadata("design:paramtypes", [CreateAllocateInventoryOrderArgs]),
@@ -60,6 +63,7 @@ __decorate([
60
63
  ], AllocateInventoryOrderMutation.prototype, "createAllocateInventoryOrder", null);
61
64
  __decorate([
62
65
  Mutation(() => AllocateInventoryOrderDto),
66
+ WmsOperation({ resource: 'allocate-inventory-order', action: 'update' }),
63
67
  __param(0, Args()),
64
68
  __metadata("design:type", Function),
65
69
  __metadata("design:paramtypes", [UpdateAllocateInventoryOrderArgs]),
@@ -67,6 +71,7 @@ __decorate([
67
71
  ], AllocateInventoryOrderMutation.prototype, "updateAllocateInventoryOrder", null);
68
72
  __decorate([
69
73
  Mutation(() => Boolean),
74
+ WmsOperation({ resource: 'allocate-inventory-order', action: 'deallocate' }),
70
75
  __param(0, Args('items', { type: () => [DeallocateOrderArgs] })),
71
76
  __metadata("design:type", Function),
72
77
  __metadata("design:paramtypes", [Array]),
@@ -5,6 +5,8 @@ import { HoldInventoryOrderService, StockService } from '@rytass/wms-module-core
5
5
  import { HoldInventoryOrderDto } from '../dto/hold-inventory-order.dto.js';
6
6
  import { CreateHoldInventoryOrderArgs, UpdateHoldInventoryOrderArgs } from '../inputs/create-hold-inventory-order.args.js';
7
7
  import { ReleaseOrderArgs } from '../inputs/release-order.args.js';
8
+ import '../auth/wms-auth.guard.js';
9
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
8
10
 
9
11
  let HoldInventoryOrderMutation = class HoldInventoryOrderMutation {
10
12
  holdInventoryOrderService;
@@ -53,6 +55,7 @@ let HoldInventoryOrderMutation = class HoldInventoryOrderMutation {
53
55
  };
54
56
  __decorate([
55
57
  Mutation(() => HoldInventoryOrderDto),
58
+ WmsOperation({ resource: 'hold-inventory-order', action: 'create' }),
56
59
  __param(0, Args()),
57
60
  __metadata("design:type", Function),
58
61
  __metadata("design:paramtypes", [CreateHoldInventoryOrderArgs]),
@@ -60,6 +63,7 @@ __decorate([
60
63
  ], HoldInventoryOrderMutation.prototype, "createHoldInventoryOrder", null);
61
64
  __decorate([
62
65
  Mutation(() => HoldInventoryOrderDto),
66
+ WmsOperation({ resource: 'hold-inventory-order', action: 'update' }),
63
67
  __param(0, Args()),
64
68
  __metadata("design:type", Function),
65
69
  __metadata("design:paramtypes", [UpdateHoldInventoryOrderArgs]),
@@ -67,6 +71,7 @@ __decorate([
67
71
  ], HoldInventoryOrderMutation.prototype, "updateHoldInventoryOrder", null);
68
72
  __decorate([
69
73
  Mutation(() => Boolean),
74
+ WmsOperation({ resource: 'hold-inventory-order', action: 'release' }),
70
75
  __param(0, Args('items', { type: () => [ReleaseOrderArgs] })),
71
76
  __metadata("design:type", Function),
72
77
  __metadata("design:paramtypes", [Array]),
@@ -29,6 +29,8 @@ import { Mutation, Args } from '@nestjs/graphql';
29
29
  import { CreateLoaderTypeArgs, UpdateLoaderTypeArgs } from '../inputs/create-loader-type.args.js';
30
30
  import { CreateLoaderArgs, CreateLoadersArgs, UpdateLoaderArgs } from '../inputs/create-loader.args.js';
31
31
  import { In } from 'typeorm';
32
+ import '../auth/wms-auth.guard.js';
33
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
32
34
 
33
35
  let LoaderMutation = class LoaderMutation {
34
36
  loaderService;
@@ -64,6 +66,7 @@ let LoaderMutation = class LoaderMutation {
64
66
  };
65
67
  __decorate([
66
68
  Mutation(() => [LoaderDto]),
69
+ WmsOperation({ resource: 'loader', action: 'create' }),
67
70
  __param(0, Args()),
68
71
  __metadata("design:type", Function),
69
72
  __metadata("design:paramtypes", [CreateLoaderArgs]),
@@ -71,6 +74,7 @@ __decorate([
71
74
  ], LoaderMutation.prototype, "createLoader", null);
72
75
  __decorate([
73
76
  Mutation(() => [LoaderDto]),
77
+ WmsOperation({ resource: 'loader', action: 'create' }),
74
78
  __param(0, Args('items', { type: () => [CreateLoadersArgs] })),
75
79
  __metadata("design:type", Function),
76
80
  __metadata("design:paramtypes", [Array]),
@@ -78,6 +82,7 @@ __decorate([
78
82
  ], LoaderMutation.prototype, "createBatchLoader", null);
79
83
  __decorate([
80
84
  Mutation(() => LoaderDto),
85
+ WmsOperation({ resource: 'loader', action: 'update' }),
81
86
  __param(0, Args()),
82
87
  __metadata("design:type", Function),
83
88
  __metadata("design:paramtypes", [UpdateLoaderArgs]),
@@ -85,6 +90,7 @@ __decorate([
85
90
  ], LoaderMutation.prototype, "updateLoader", null);
86
91
  __decorate([
87
92
  Mutation(() => LoaderTypeDto),
93
+ WmsOperation({ resource: 'loader', action: 'create' }),
88
94
  __param(0, Args()),
89
95
  __metadata("design:type", Function),
90
96
  __metadata("design:paramtypes", [CreateLoaderTypeArgs]),
@@ -92,6 +98,7 @@ __decorate([
92
98
  ], LoaderMutation.prototype, "createLoaderType", null);
93
99
  __decorate([
94
100
  Mutation(() => LoaderTypeDto),
101
+ WmsOperation({ resource: 'loader', action: 'update' }),
95
102
  __param(0, Args()),
96
103
  __metadata("design:type", Function),
97
104
  __metadata("design:paramtypes", [UpdateLoaderTypeArgs]),
@@ -4,6 +4,8 @@ import { Mutation, Args } from '@nestjs/graphql';
4
4
  import { LocationService } from '@rytass/wms-module-core';
5
5
  import { LocationDto } from '../dto/location.dto.js';
6
6
  import { CreateLocationArgs, UpdateLocationArgs } from '../inputs/create-location.args.js';
7
+ import '../auth/wms-auth.guard.js';
8
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
7
9
 
8
10
  let LocationMutation = class LocationMutation {
9
11
  locationService;
@@ -19,6 +21,7 @@ let LocationMutation = class LocationMutation {
19
21
  };
20
22
  __decorate([
21
23
  Mutation(() => LocationDto),
24
+ WmsOperation({ resource: 'location', action: 'create' }),
22
25
  __param(0, Args()),
23
26
  __metadata("design:type", Function),
24
27
  __metadata("design:paramtypes", [CreateLocationArgs]),
@@ -26,6 +29,7 @@ __decorate([
26
29
  ], LocationMutation.prototype, "createLocation", null);
27
30
  __decorate([
28
31
  Mutation(() => LocationDto),
32
+ WmsOperation({ resource: 'location', action: 'update' }),
29
33
  __param(0, Args()),
30
34
  __metadata("design:type", Function),
31
35
  __metadata("design:paramtypes", [UpdateLocationArgs]),
@@ -27,6 +27,8 @@ import '../dto/quality-inspection-order.dto.js';
27
27
  import '../dto/quality-inspection-order-item.dto.js';
28
28
  import { CreateMaterialArgs, UpdateMaterialArgs } from '../inputs/create-material.args.js';
29
29
  import { MaterialService } from '@rytass/wms-module-core';
30
+ import '../auth/wms-auth.guard.js';
31
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
30
32
 
31
33
  let MaterialMutation = class MaterialMutation {
32
34
  materialService;
@@ -42,6 +44,7 @@ let MaterialMutation = class MaterialMutation {
42
44
  };
43
45
  __decorate([
44
46
  Mutation(() => MaterialDto),
47
+ WmsOperation({ resource: 'material', action: 'create' }),
45
48
  __param(0, Args()),
46
49
  __metadata("design:type", Function),
47
50
  __metadata("design:paramtypes", [CreateMaterialArgs]),
@@ -49,6 +52,7 @@ __decorate([
49
52
  ], MaterialMutation.prototype, "createMaterial", null);
50
53
  __decorate([
51
54
  Mutation(() => MaterialDto),
55
+ WmsOperation({ resource: 'material', action: 'update' }),
52
56
  __param(0, Args()),
53
57
  __metadata("design:type", Function),
54
58
  __metadata("design:paramtypes", [UpdateMaterialArgs]),
@@ -4,6 +4,8 @@ import { Mutation, Args, Resolver } from '@nestjs/graphql';
4
4
  import { StockService, MergeBatchOrderService } from '@rytass/wms-module-core';
5
5
  import { MergeBatchArgs } from '../inputs/merge-batch.args.js';
6
6
  import { MergeBatchOrderDto } from '../dto/merge-batch-order.dto.js';
7
+ import '../auth/wms-auth.guard.js';
8
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
7
9
 
8
10
  let MergeBatchMutation = class MergeBatchMutation {
9
11
  stockService;
@@ -29,6 +31,7 @@ let MergeBatchMutation = class MergeBatchMutation {
29
31
  };
30
32
  __decorate([
31
33
  Mutation(() => MergeBatchOrderDto),
34
+ WmsOperation({ resource: 'batch', action: 'merge' }),
32
35
  __param(0, Args()),
33
36
  __metadata("design:type", Function),
34
37
  __metadata("design:paramtypes", [MergeBatchArgs]),
@@ -4,6 +4,8 @@ import { Mutation, Args } from '@nestjs/graphql';
4
4
  import { QualityInspectionOrderService, StockService } from '@rytass/wms-module-core';
5
5
  import { QualityInspectionOrderDto } from '../dto/quality-inspection-order.dto.js';
6
6
  import { CreateQualityInspectionOrderArgs } from '../inputs/create-quality-inspection-order.args.js';
7
+ import '../auth/wms-auth.guard.js';
8
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
7
9
 
8
10
  let QualityInspectionOrderMutation = class QualityInspectionOrderMutation {
9
11
  qualityInspectionOrderService;
@@ -30,6 +32,7 @@ let QualityInspectionOrderMutation = class QualityInspectionOrderMutation {
30
32
  };
31
33
  __decorate([
32
34
  Mutation(() => QualityInspectionOrderDto),
35
+ WmsOperation({ resource: 'quality-inspection-order', action: 'inspect' }),
33
36
  __param(0, Args()),
34
37
  __metadata("design:type", Function),
35
38
  __metadata("design:paramtypes", [CreateQualityInspectionOrderArgs]),
@@ -29,6 +29,8 @@ import '../dto/quality-inspection-order-item.dto.js';
29
29
  import { CreateReceiveInventoryOrderArgs, UpdateReceiveInventoryOrderArgs } from '../inputs/create-receive-inventory-order.args.js';
30
30
  import { DataSource } from 'typeorm';
31
31
  import { ReceiveOrderArgs } from '../inputs/receive-order.args.js';
32
+ import '../auth/wms-auth.guard.js';
33
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
32
34
 
33
35
  let ReceiveInventoryOrderMutation = class ReceiveInventoryOrderMutation {
34
36
  dataSource;
@@ -64,6 +66,7 @@ let ReceiveInventoryOrderMutation = class ReceiveInventoryOrderMutation {
64
66
  };
65
67
  __decorate([
66
68
  Mutation(() => ReceiveInventoryOrderDto),
69
+ WmsOperation({ resource: 'receive-inventory-order', action: 'create' }),
67
70
  __param(0, Args()),
68
71
  __metadata("design:type", Function),
69
72
  __metadata("design:paramtypes", [CreateReceiveInventoryOrderArgs]),
@@ -71,6 +74,7 @@ __decorate([
71
74
  ], ReceiveInventoryOrderMutation.prototype, "createReceiveInventoryOrder", null);
72
75
  __decorate([
73
76
  Mutation(() => ReceiveInventoryOrderDto),
77
+ WmsOperation({ resource: 'receive-inventory-order', action: 'update' }),
74
78
  __param(0, Args()),
75
79
  __metadata("design:type", Function),
76
80
  __metadata("design:paramtypes", [UpdateReceiveInventoryOrderArgs]),
@@ -78,6 +82,7 @@ __decorate([
78
82
  ], ReceiveInventoryOrderMutation.prototype, "updateReceiveInventoryOrder", null);
79
83
  __decorate([
80
84
  Mutation(() => Boolean),
85
+ WmsOperation({ resource: 'receive-inventory-order', action: 'receive' }),
81
86
  __param(0, Args('items', { type: () => [ReceiveOrderArgs] })),
82
87
  __metadata("design:type", Function),
83
88
  __metadata("design:paramtypes", [Array]),
@@ -4,6 +4,8 @@ import { Mutation, Args, Resolver } from '@nestjs/graphql';
4
4
  import { StockService, ReclassifyInventoryOrderService } from '@rytass/wms-module-core';
5
5
  import { ReclassifyInventoryOrderArgs } from '../inputs/reclassify-inventory-order.args.js';
6
6
  import { ReclassifyInventoryOrderDto } from '../dto/reclassify-inventory-order.dto.js';
7
+ import '../auth/wms-auth.guard.js';
8
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
7
9
 
8
10
  let ReclassifyInventoryOrderMutation = class ReclassifyInventoryOrderMutation {
9
11
  stockService;
@@ -30,6 +32,7 @@ let ReclassifyInventoryOrderMutation = class ReclassifyInventoryOrderMutation {
30
32
  };
31
33
  __decorate([
32
34
  Mutation(() => ReclassifyInventoryOrderDto),
35
+ WmsOperation({ resource: 'reclassify-inventory-order', action: 'reclassify' }),
33
36
  __param(0, Args()),
34
37
  __metadata("design:type", Function),
35
38
  __metadata("design:paramtypes", [ReclassifyInventoryOrderArgs]),
@@ -4,6 +4,8 @@ import { Mutation, Args } from '@nestjs/graphql';
4
4
  import { ScrapeService, StockService } from '@rytass/wms-module-core';
5
5
  import { ScrapeOrderDto } from '../dto/scrape-order.dto.js';
6
6
  import { ScrapeOrderArgs } from '../inputs/scrape-order.args.js';
7
+ import '../auth/wms-auth.guard.js';
8
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
7
9
 
8
10
  let ScrapeMutation = class ScrapeMutation {
9
11
  scrapeService;
@@ -24,6 +26,7 @@ let ScrapeMutation = class ScrapeMutation {
24
26
  };
25
27
  __decorate([
26
28
  Mutation(() => ScrapeOrderDto),
29
+ WmsOperation({ resource: 'scrape-order', action: 'scrape' }),
27
30
  __param(0, Args()),
28
31
  __metadata("design:type", Function),
29
32
  __metadata("design:paramtypes", [ScrapeOrderArgs]),
@@ -29,6 +29,8 @@ import { Mutation, Args } from '@nestjs/graphql';
29
29
  import { CreateShipInventoryOrderArgs, UpdateShipInventoryOrderArgs } from '../inputs/create-ship-inventory-order.args.js';
30
30
  import { ShipOrderArgs } from '../inputs/ship-order.args.js';
31
31
  import { CancelShipOrderArgs } from '../inputs/cancel-ship-order.args.js';
32
+ import '../auth/wms-auth.guard.js';
33
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
32
34
 
33
35
  let ShipInventoryOrderMutation = class ShipInventoryOrderMutation {
34
36
  shipInventoryOrderService;
@@ -72,6 +74,7 @@ let ShipInventoryOrderMutation = class ShipInventoryOrderMutation {
72
74
  };
73
75
  __decorate([
74
76
  Mutation(() => ShipInventoryOrderDto),
77
+ WmsOperation({ resource: 'ship-inventory-order', action: 'create' }),
75
78
  __param(0, Args()),
76
79
  __metadata("design:type", Function),
77
80
  __metadata("design:paramtypes", [CreateShipInventoryOrderArgs]),
@@ -79,6 +82,7 @@ __decorate([
79
82
  ], ShipInventoryOrderMutation.prototype, "createShipInventoryOrder", null);
80
83
  __decorate([
81
84
  Mutation(() => ShipInventoryOrderDto),
85
+ WmsOperation({ resource: 'ship-inventory-order', action: 'update' }),
82
86
  __param(0, Args()),
83
87
  __metadata("design:type", Function),
84
88
  __metadata("design:paramtypes", [UpdateShipInventoryOrderArgs]),
@@ -86,6 +90,7 @@ __decorate([
86
90
  ], ShipInventoryOrderMutation.prototype, "updateShipInventoryOrder", null);
87
91
  __decorate([
88
92
  Mutation(() => Boolean),
93
+ WmsOperation({ resource: 'ship-inventory-order', action: 'ship' }),
89
94
  __param(0, Args('items', { type: () => [ShipOrderArgs] })),
90
95
  __metadata("design:type", Function),
91
96
  __metadata("design:paramtypes", [Array]),
@@ -93,6 +98,7 @@ __decorate([
93
98
  ], ShipInventoryOrderMutation.prototype, "ship", null);
94
99
  __decorate([
95
100
  Mutation(() => Boolean),
101
+ WmsOperation({ resource: 'ship-inventory-order', action: 'cancel' }),
96
102
  __param(0, Args('items', { type: () => [CancelShipOrderArgs] })),
97
103
  __metadata("design:type", Function),
98
104
  __metadata("design:paramtypes", [Array]),
@@ -4,6 +4,8 @@ import { Mutation, Args, Resolver } from '@nestjs/graphql';
4
4
  import { StockService, SplitBatchOrderService } from '@rytass/wms-module-core';
5
5
  import { SplitBatchArgs } from '../inputs/split-batch.args.js';
6
6
  import { SplitBatchOrderDto } from '../dto/split-batch-order.dto.js';
7
+ import '../auth/wms-auth.guard.js';
8
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
7
9
 
8
10
  let SplitBatchMutation = class SplitBatchMutation {
9
11
  stockService;
@@ -23,6 +25,7 @@ let SplitBatchMutation = class SplitBatchMutation {
23
25
  };
24
26
  __decorate([
25
27
  Mutation(() => SplitBatchOrderDto),
28
+ WmsOperation({ resource: 'batch', action: 'split' }),
26
29
  __param(0, Args()),
27
30
  __metadata("design:type", Function),
28
31
  __metadata("design:paramtypes", [SplitBatchArgs]),
@@ -5,6 +5,8 @@ import { TransferCustomerOrderService, StockService } from '@rytass/wms-module-c
5
5
  import { TransferCustomerOrderDto } from '../dto/transfer-customer-order.dto.js';
6
6
  import { CreateTransferCustomerOrderArgs, UpdateTransferCustomerOrderArgs } from '../inputs/create-transfer-customer-order.args.js';
7
7
  import { ReturnTransferCustomerOrderArgs } from '../inputs/return-transfer-customer-order.args.js';
8
+ import '../auth/wms-auth.guard.js';
9
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
8
10
 
9
11
  let TransferCustomerOrderMutation = class TransferCustomerOrderMutation {
10
12
  transferCustomerOrderService;
@@ -53,6 +55,7 @@ let TransferCustomerOrderMutation = class TransferCustomerOrderMutation {
53
55
  };
54
56
  __decorate([
55
57
  Mutation(() => TransferCustomerOrderDto),
58
+ WmsOperation({ resource: 'transfer-customer-order', action: 'create' }),
56
59
  __param(0, Args()),
57
60
  __metadata("design:type", Function),
58
61
  __metadata("design:paramtypes", [CreateTransferCustomerOrderArgs]),
@@ -60,6 +63,7 @@ __decorate([
60
63
  ], TransferCustomerOrderMutation.prototype, "createTransferCustomerOrder", null);
61
64
  __decorate([
62
65
  Mutation(() => TransferCustomerOrderDto),
66
+ WmsOperation({ resource: 'transfer-customer-order', action: 'update' }),
63
67
  __param(0, Args()),
64
68
  __metadata("design:type", Function),
65
69
  __metadata("design:paramtypes", [UpdateTransferCustomerOrderArgs]),
@@ -67,6 +71,7 @@ __decorate([
67
71
  ], TransferCustomerOrderMutation.prototype, "updateTransferCustomerOrder", null);
68
72
  __decorate([
69
73
  Mutation(() => Boolean),
74
+ WmsOperation({ resource: 'transfer-customer-order', action: 'return' }),
70
75
  __param(0, Args('items', { type: () => [ReturnTransferCustomerOrderArgs] })),
71
76
  __metadata("design:type", Function),
72
77
  __metadata("design:paramtypes", [Array]),