@rytass/wms-module-core 0.3.1 → 0.5.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 +48 -1
- package/docs/README.md +2 -0
- package/docs/api-reference.md +38 -1
- package/docs/custom-entities.md +229 -0
- package/index.cjs.js +325 -98
- package/index.js +3 -0
- package/lib/core.module.js +88 -1
- package/lib/models/extensions/allocate-inventory-order/allocate-inventory-order-item.entity.js +1 -0
- package/lib/models/extensions/hold-inventory-order/hold-inventory-order-item.entity.js +1 -0
- package/lib/models/extensions/merge-batch-order/merge-batch-order-item.entity.js +1 -0
- package/lib/models/extensions/quality-inspection-order/quality-inspection-order-item.entity.js +1 -0
- package/lib/models/extensions/reclassify-inventory-order/reclassify-inventory-order-item.entity.js +1 -0
- package/lib/models/extensions/scrape-order/scrape-order-item.entity.js +1 -0
- package/lib/models/extensions/split-batch-order/split-batch-order-item.entity.js +1 -0
- package/lib/models/extensions/transfer-customer-order/transfer-customer-order-item.entity.js +1 -0
- package/lib/models/extensions/transfer-order/transfer-order-item.entity.js +1 -0
- package/lib/models/extensions/transfer-vendor-order/transfer-vendor-order-item.entity.js +1 -0
- package/lib/models/index.d.ts +1 -0
- package/lib/models/metadata/index.d.ts +1 -0
- package/lib/models/metadata/order.entity.d.ts +9 -0
- package/lib/models/metadata/order.entity.js +5 -0
- package/lib/models/models.module.js +21 -1
- package/lib/models/wms-entities.d.ts +45 -0
- package/lib/models/wms-entities.js +82 -0
- package/lib/services/allocate-inventory-order.service.d.ts +3 -1
- package/lib/services/allocate-inventory-order.service.js +10 -6
- package/lib/services/batch.service.js +5 -3
- package/lib/services/hold-inventory-order.service.d.ts +3 -1
- package/lib/services/hold-inventory-order.service.js +10 -6
- package/lib/services/loader.service.js +2 -0
- package/lib/services/location.service.js +2 -0
- package/lib/services/material.service.js +2 -0
- package/lib/services/merge-batch-order.service.d.ts +3 -1
- package/lib/services/merge-batch-order.service.js +13 -9
- package/lib/services/quality-inspection-order.service.d.ts +3 -1
- package/lib/services/quality-inspection-order.service.js +12 -8
- package/lib/services/receive-inventory-order.service.d.ts +3 -1
- package/lib/services/receive-inventory-order.service.js +17 -13
- package/lib/services/reclassify-inventory-order.service.d.ts +3 -1
- package/lib/services/reclassify-inventory-order.service.js +15 -11
- package/lib/services/scrape.service.d.ts +3 -1
- package/lib/services/scrape.service.js +9 -5
- package/lib/services/ship-inventory-order.service.d.ts +3 -1
- package/lib/services/ship-inventory-order.service.js +21 -17
- package/lib/services/split-batch-order.service.d.ts +3 -1
- package/lib/services/split-batch-order.service.js +13 -9
- package/lib/services/stock.service.d.ts +3 -1
- package/lib/services/stock.service.js +23 -12
- package/lib/services/transfer-customer-order.service.d.ts +3 -1
- package/lib/services/transfer-customer-order.service.js +12 -8
- package/lib/services/transfer-order.service.d.ts +3 -1
- package/lib/services/transfer-order.service.js +11 -7
- package/lib/services/transfer-vendor-order.service.d.ts +3 -1
- package/lib/services/transfer-vendor-order.service.js +12 -8
- package/lib/services/unit.service.js +2 -0
- package/lib/services/warehouse-map.service.d.ts +3 -1
- package/lib/services/warehouse-map.service.js +9 -6
- package/lib/typings/entity-overrides.d.ts +34 -0
- package/lib/typings/entity-overrides.js +7 -0
- package/package.json +2 -2
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { Injectable } from '@nestjs/common';
|
|
3
3
|
import { DataSource } from 'typeorm';
|
|
4
|
-
import {
|
|
4
|
+
import { WmsEntities } from '../models/wms-entities.js';
|
|
5
5
|
|
|
6
6
|
let WarehouseMapDataService = class WarehouseMapDataService {
|
|
7
7
|
dataSource;
|
|
8
|
+
entities;
|
|
8
9
|
defaultMapDataKey = 'DEFAULT_MAP_DATA_KEY';
|
|
9
10
|
warehouseMapDataRepository;
|
|
10
|
-
constructor(dataSource) {
|
|
11
|
+
constructor(dataSource, entities) {
|
|
11
12
|
this.dataSource = dataSource;
|
|
13
|
+
this.entities = entities;
|
|
12
14
|
this.warehouseMapDataRepository =
|
|
13
|
-
this.dataSource.getRepository(
|
|
15
|
+
this.dataSource.getRepository(this.entities.warehouseMap);
|
|
14
16
|
}
|
|
15
17
|
onApplicationBootstrap() {
|
|
16
18
|
this.dataSource.transaction(async (manager) => {
|
|
17
19
|
const defaultMapData = await manager
|
|
18
|
-
.getRepository(
|
|
20
|
+
.getRepository(this.entities.warehouseMap)
|
|
19
21
|
.findOneBy({ id: this.defaultMapDataKey });
|
|
20
22
|
if (!defaultMapData) {
|
|
21
|
-
await manager.getRepository(
|
|
23
|
+
await manager.getRepository(this.entities.warehouseMap).save(manager.getRepository(this.entities.warehouseMap).create({
|
|
22
24
|
id: this.defaultMapDataKey,
|
|
23
25
|
mapData: {
|
|
24
26
|
id: this.defaultMapDataKey,
|
|
@@ -32,7 +34,8 @@ let WarehouseMapDataService = class WarehouseMapDataService {
|
|
|
32
34
|
};
|
|
33
35
|
WarehouseMapDataService = __decorate([
|
|
34
36
|
Injectable(),
|
|
35
|
-
__metadata("design:paramtypes", [DataSource
|
|
37
|
+
__metadata("design:paramtypes", [DataSource,
|
|
38
|
+
WmsEntities])
|
|
36
39
|
], WarehouseMapDataService);
|
|
37
40
|
|
|
38
41
|
export { WarehouseMapDataService };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { MaterialEntityClass } from '../models/metadata/material.entity';
|
|
2
|
+
/**
|
|
3
|
+
* Consumer-supplied replacements for the entity classes the module binds its
|
|
4
|
+
* entity Symbols to.
|
|
5
|
+
*
|
|
6
|
+
* An override has to be a `@ChildEntity()` of the class it replaces: the tables
|
|
7
|
+
* (`materials`, …) and their `@TableInheritance()` discriminator columns are part
|
|
8
|
+
* of the module's schema contract, so an override *joins* the existing
|
|
9
|
+
* single-table hierarchy — it never moves the data to another table.
|
|
10
|
+
*
|
|
11
|
+
* Entity classes are static, so — unlike the credentials in
|
|
12
|
+
* `WMSBaseModuleOptions` — they are configured **synchronously**, even on
|
|
13
|
+
* `forRootAsync`. `TypeOrmModule.forFeature()` and the `Symbol` → entity
|
|
14
|
+
* providers are built while the module graph is assembled, long before an async
|
|
15
|
+
* options factory has resolved; an entity that only appears in the factory's
|
|
16
|
+
* result would be too late to register. `WmsModuleCoreModule.forRootAsync`
|
|
17
|
+
* therefore takes these next to `defaultLocationKey` and forwards them into the
|
|
18
|
+
* base module's options for you, and throws if the async factory tries to set
|
|
19
|
+
* one behind their back.
|
|
20
|
+
*/
|
|
21
|
+
export interface WmsModuleEntityOverrides {
|
|
22
|
+
/**
|
|
23
|
+
* Replaces `MaterialEntityClass` everywhere the module reads or writes
|
|
24
|
+
* materials: the `MaterialEntity` Symbol, `MaterialService`, the receive /
|
|
25
|
+
* ship / reclassify order services, `StockService`'s `materialKey` filter and
|
|
26
|
+
* the GraphQL `material` DataLoaders.
|
|
27
|
+
*/
|
|
28
|
+
readonly materialEntity?: new () => MaterialEntityClass;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The overridable entity options, paired for `Object.keys`-style iteration over
|
|
32
|
+
* {@link WmsModuleEntityOverrides} without losing the key type.
|
|
33
|
+
*/
|
|
34
|
+
export declare const WMS_ENTITY_OVERRIDE_KEYS: readonly (keyof WmsModuleEntityOverrides)[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rytass/wms-module-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Rytass WMS Module — NestJS services and TypeORM entities for warehouse management",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rytass",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@rytass/wms-base-nestjs-module": "0.
|
|
44
|
+
"@rytass/wms-base-nestjs-module": "0.4.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@nestjs/common": "^11.0.0",
|