@tolinax/ayoune-interfaces 2026.28.0 → 2026.30.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/data/modelNames.d.ts +8 -0
- package/data/modelNames.js +8 -0
- package/data/modelsAndRights.js +108 -0
- package/interfaces/IDock.d.ts +37 -0
- package/interfaces/IDock.js +2 -0
- package/interfaces/IDockAppointment.d.ts +41 -0
- package/interfaces/IDockAppointment.js +2 -0
- package/interfaces/IInventoryAdjustment.d.ts +54 -0
- package/interfaces/IInventoryAdjustment.js +2 -0
- package/interfaces/IPickWave.d.ts +40 -0
- package/interfaces/IPickWave.js +2 -0
- package/interfaces/ITradeChannel.d.ts +64 -0
- package/interfaces/ITradeChannel.js +2 -0
- package/interfaces/ITradeChannelEvent.d.ts +31 -0
- package/interfaces/ITradeChannelEvent.js +2 -0
- package/interfaces/ITradeChannelOrder.d.ts +143 -0
- package/interfaces/ITradeChannelOrder.js +2 -0
- package/interfaces/ITransportOrder.d.ts +60 -0
- package/interfaces/ITransportOrder.js +2 -0
- package/interfaces/index.d.ts +8 -0
- package/interfaces/index.js +8 -0
- package/package.json +1 -1
package/data/modelNames.d.ts
CHANGED
|
@@ -253,6 +253,8 @@ export declare enum aMN {
|
|
|
253
253
|
DevOpsAlerts = "DevOpsAlerts",
|
|
254
254
|
DiscountGroups = "DiscountGroups",
|
|
255
255
|
DMCampaigns = "DMCampaigns",
|
|
256
|
+
DockAppointments = "DockAppointments",
|
|
257
|
+
Docks = "Docks",
|
|
256
258
|
Documents = "Documents",
|
|
257
259
|
DoiLogs = "DoiLogs",
|
|
258
260
|
Dois = "Dois",
|
|
@@ -352,6 +354,7 @@ export declare enum aMN {
|
|
|
352
354
|
InternalChatMessages = "InternalChatMessages",
|
|
353
355
|
InternalForms = "InternalForms",
|
|
354
356
|
InternalOrders = "InternalOrders",
|
|
357
|
+
InventoryAdjustments = "InventoryAdjustments",
|
|
355
358
|
InventoryLists = "InventoryLists",
|
|
356
359
|
Invoices = "Invoices",
|
|
357
360
|
IoTDevices = "IoTDevices",
|
|
@@ -453,6 +456,7 @@ export declare enum aMN {
|
|
|
453
456
|
PaymentProviders = "PaymentProviders",
|
|
454
457
|
PermissionRequests = "PermissionRequests",
|
|
455
458
|
PickLists = "PickLists",
|
|
459
|
+
PickWaves = "PickWaves",
|
|
456
460
|
PimSelections = "PimSelections",
|
|
457
461
|
Pipelines = "Pipelines",
|
|
458
462
|
Polls = "Polls",
|
|
@@ -609,8 +613,12 @@ export declare enum aMN {
|
|
|
609
613
|
TextLinks = "TextLinks",
|
|
610
614
|
Tickets = "Tickets",
|
|
611
615
|
Tips = "Tips",
|
|
616
|
+
TradeChannelEvents = "TradeChannelEvents",
|
|
617
|
+
TradeChannelOrders = "TradeChannelOrders",
|
|
618
|
+
TradeChannels = "TradeChannels",
|
|
612
619
|
Trades = "Trades",
|
|
613
620
|
Transactions = "Transactions",
|
|
621
|
+
TransportOrders = "TransportOrders",
|
|
614
622
|
Travels = "Travels",
|
|
615
623
|
TriggerActionsLogs = "TriggerActionsLogs",
|
|
616
624
|
TriggerChains = "TriggerChains",
|
package/data/modelNames.js
CHANGED
|
@@ -257,6 +257,8 @@ var aMN;
|
|
|
257
257
|
aMN["DevOpsAlerts"] = "DevOpsAlerts";
|
|
258
258
|
aMN["DiscountGroups"] = "DiscountGroups";
|
|
259
259
|
aMN["DMCampaigns"] = "DMCampaigns";
|
|
260
|
+
aMN["DockAppointments"] = "DockAppointments";
|
|
261
|
+
aMN["Docks"] = "Docks";
|
|
260
262
|
aMN["Documents"] = "Documents";
|
|
261
263
|
aMN["DoiLogs"] = "DoiLogs";
|
|
262
264
|
aMN["Dois"] = "Dois";
|
|
@@ -356,6 +358,7 @@ var aMN;
|
|
|
356
358
|
aMN["InternalChatMessages"] = "InternalChatMessages";
|
|
357
359
|
aMN["InternalForms"] = "InternalForms";
|
|
358
360
|
aMN["InternalOrders"] = "InternalOrders";
|
|
361
|
+
aMN["InventoryAdjustments"] = "InventoryAdjustments";
|
|
359
362
|
aMN["InventoryLists"] = "InventoryLists";
|
|
360
363
|
aMN["Invoices"] = "Invoices";
|
|
361
364
|
aMN["IoTDevices"] = "IoTDevices";
|
|
@@ -457,6 +460,7 @@ var aMN;
|
|
|
457
460
|
aMN["PaymentProviders"] = "PaymentProviders";
|
|
458
461
|
aMN["PermissionRequests"] = "PermissionRequests";
|
|
459
462
|
aMN["PickLists"] = "PickLists";
|
|
463
|
+
aMN["PickWaves"] = "PickWaves";
|
|
460
464
|
aMN["PimSelections"] = "PimSelections";
|
|
461
465
|
aMN["Pipelines"] = "Pipelines";
|
|
462
466
|
aMN["Polls"] = "Polls";
|
|
@@ -613,8 +617,12 @@ var aMN;
|
|
|
613
617
|
aMN["TextLinks"] = "TextLinks";
|
|
614
618
|
aMN["Tickets"] = "Tickets";
|
|
615
619
|
aMN["Tips"] = "Tips";
|
|
620
|
+
aMN["TradeChannelEvents"] = "TradeChannelEvents";
|
|
621
|
+
aMN["TradeChannelOrders"] = "TradeChannelOrders";
|
|
622
|
+
aMN["TradeChannels"] = "TradeChannels";
|
|
616
623
|
aMN["Trades"] = "Trades";
|
|
617
624
|
aMN["Transactions"] = "Transactions";
|
|
625
|
+
aMN["TransportOrders"] = "TransportOrders";
|
|
618
626
|
aMN["Travels"] = "Travels";
|
|
619
627
|
aMN["TriggerActionsLogs"] = "TriggerActionsLogs";
|
|
620
628
|
aMN["TriggerChains"] = "TriggerChains";
|
package/data/modelsAndRights.js
CHANGED
|
@@ -2839,6 +2839,26 @@ const modelsAndRights = [
|
|
|
2839
2839
|
allowDuplicate: false,
|
|
2840
2840
|
updateBy: "_id",
|
|
2841
2841
|
},
|
|
2842
|
+
{
|
|
2843
|
+
plural: "DockAppointments",
|
|
2844
|
+
singular: "DockAppointment",
|
|
2845
|
+
module: "warehouse",
|
|
2846
|
+
right: "warehouse.dockappointments",
|
|
2847
|
+
readOnly: false,
|
|
2848
|
+
importable: false,
|
|
2849
|
+
allowDuplicate: false,
|
|
2850
|
+
updateBy: "_id",
|
|
2851
|
+
},
|
|
2852
|
+
{
|
|
2853
|
+
plural: "Docks",
|
|
2854
|
+
singular: "Dock",
|
|
2855
|
+
module: "warehouse",
|
|
2856
|
+
right: "warehouse.docks",
|
|
2857
|
+
readOnly: false,
|
|
2858
|
+
importable: false,
|
|
2859
|
+
allowDuplicate: false,
|
|
2860
|
+
updateBy: "_id",
|
|
2861
|
+
},
|
|
2842
2862
|
{
|
|
2843
2863
|
plural: "Documents",
|
|
2844
2864
|
singular: "Document",
|
|
@@ -3749,6 +3769,16 @@ const modelsAndRights = [
|
|
|
3749
3769
|
allowDuplicate: true,
|
|
3750
3770
|
updateBy: "_id",
|
|
3751
3771
|
},
|
|
3772
|
+
{
|
|
3773
|
+
plural: "InventoryAdjustments",
|
|
3774
|
+
singular: "InventoryAdjustment",
|
|
3775
|
+
module: "warehouse",
|
|
3776
|
+
right: "warehouse.inventoryadjustments",
|
|
3777
|
+
readOnly: false,
|
|
3778
|
+
importable: false,
|
|
3779
|
+
allowDuplicate: false,
|
|
3780
|
+
updateBy: "_id",
|
|
3781
|
+
},
|
|
3752
3782
|
{
|
|
3753
3783
|
plural: "InventoryLists",
|
|
3754
3784
|
singular: "InventoryList",
|
|
@@ -4733,6 +4763,16 @@ const modelsAndRights = [
|
|
|
4733
4763
|
allowDuplicate: false,
|
|
4734
4764
|
updateBy: "_id",
|
|
4735
4765
|
},
|
|
4766
|
+
{
|
|
4767
|
+
plural: "PickWaves",
|
|
4768
|
+
singular: "PickWave",
|
|
4769
|
+
module: "warehouse",
|
|
4770
|
+
right: "warehouse.pickwaves",
|
|
4771
|
+
readOnly: false,
|
|
4772
|
+
importable: false,
|
|
4773
|
+
allowDuplicate: false,
|
|
4774
|
+
updateBy: "_id",
|
|
4775
|
+
},
|
|
4736
4776
|
{
|
|
4737
4777
|
plural: "PimSelections",
|
|
4738
4778
|
singular: "PimSelection",
|
|
@@ -6203,6 +6243,16 @@ const modelsAndRights = [
|
|
|
6203
6243
|
allowDuplicate: false,
|
|
6204
6244
|
updateBy: "_id",
|
|
6205
6245
|
},
|
|
6246
|
+
{
|
|
6247
|
+
plural: "TransportOrders",
|
|
6248
|
+
singular: "TransportOrder",
|
|
6249
|
+
module: "warehouse",
|
|
6250
|
+
right: "warehouse.transportorders",
|
|
6251
|
+
readOnly: false,
|
|
6252
|
+
importable: false,
|
|
6253
|
+
allowDuplicate: false,
|
|
6254
|
+
updateBy: "_id",
|
|
6255
|
+
},
|
|
6206
6256
|
{
|
|
6207
6257
|
plural: "Travels",
|
|
6208
6258
|
singular: "Travel",
|
|
@@ -6646,6 +6696,64 @@ const modelsAndRights = [
|
|
|
6646
6696
|
allowDuplicate: false,
|
|
6647
6697
|
updateBy: "_id",
|
|
6648
6698
|
},
|
|
6699
|
+
{
|
|
6700
|
+
plural: "TradeChannels",
|
|
6701
|
+
singular: "TradeChannel",
|
|
6702
|
+
module: "purchase",
|
|
6703
|
+
right: "purchase.tradechannels",
|
|
6704
|
+
readOnly: false,
|
|
6705
|
+
importable: false,
|
|
6706
|
+
allowDuplicate: false,
|
|
6707
|
+
updateBy: "_id",
|
|
6708
|
+
searchable: true,
|
|
6709
|
+
searchableFields: ["label", "externalAccountId", "provider"],
|
|
6710
|
+
},
|
|
6711
|
+
{
|
|
6712
|
+
plural: "TradeChannelOrders",
|
|
6713
|
+
singular: "TradeChannelOrder",
|
|
6714
|
+
module: "purchase",
|
|
6715
|
+
right: "purchase.tradechannelorders",
|
|
6716
|
+
readOnly: false,
|
|
6717
|
+
importable: false,
|
|
6718
|
+
allowDuplicate: false,
|
|
6719
|
+
updateBy: "_id",
|
|
6720
|
+
searchable: true,
|
|
6721
|
+
searchableFields: ["externalId", "provider", "status", "counterparty.name"],
|
|
6722
|
+
actions: [
|
|
6723
|
+
{
|
|
6724
|
+
title: "Refresh from provider",
|
|
6725
|
+
action: "refresh",
|
|
6726
|
+
availability: "single",
|
|
6727
|
+
method: "POST",
|
|
6728
|
+
icon: "refresh",
|
|
6729
|
+
},
|
|
6730
|
+
{
|
|
6731
|
+
title: "Match products",
|
|
6732
|
+
action: "match-products",
|
|
6733
|
+
availability: "both",
|
|
6734
|
+
method: "POST",
|
|
6735
|
+
icon: "link",
|
|
6736
|
+
},
|
|
6737
|
+
{
|
|
6738
|
+
title: "Promote to SupplierOrder",
|
|
6739
|
+
action: "promote",
|
|
6740
|
+
availability: "single",
|
|
6741
|
+
method: "POST",
|
|
6742
|
+
icon: "upgrade",
|
|
6743
|
+
confirmation: "Promote this trade-channel order into a SupplierOrder + GoodsReceipt? This cannot be undone.",
|
|
6744
|
+
},
|
|
6745
|
+
],
|
|
6746
|
+
},
|
|
6747
|
+
{
|
|
6748
|
+
plural: "TradeChannelEvents",
|
|
6749
|
+
singular: "TradeChannelEvent",
|
|
6750
|
+
module: "purchase",
|
|
6751
|
+
right: "purchase.tradechannelevents",
|
|
6752
|
+
readOnly: true,
|
|
6753
|
+
importable: false,
|
|
6754
|
+
allowDuplicate: false,
|
|
6755
|
+
updateBy: "_id",
|
|
6756
|
+
},
|
|
6649
6757
|
];
|
|
6650
6758
|
exports.modelsAndRights = modelsAndRights;
|
|
6651
6759
|
exports.default = modelsAndRights;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IDefaultFields } from "./IDefaultFields";
|
|
2
|
+
/**
|
|
3
|
+
* Dock — physical loading/unloading bay at a warehouse.
|
|
4
|
+
*
|
|
5
|
+
* Used for receiving (inbound) and shipping (outbound) operations.
|
|
6
|
+
* Can be scheduled via IDockAppointment.
|
|
7
|
+
*
|
|
8
|
+
* Solves the gap that there is no formal dock management — currently trucks
|
|
9
|
+
* just arrive and warehouse workers improvise.
|
|
10
|
+
*/
|
|
11
|
+
export interface IDock extends IDefaultFields {
|
|
12
|
+
_customerID: ObjectId;
|
|
13
|
+
_clientID?: ObjectId[];
|
|
14
|
+
_subID?: ObjectId[];
|
|
15
|
+
warehouse: ObjectId;
|
|
16
|
+
name: string;
|
|
17
|
+
code?: string;
|
|
18
|
+
type: "inbound" | "outbound" | "both";
|
|
19
|
+
status: "available" | "occupied" | "maintenance" | "blocked";
|
|
20
|
+
maxWeight?: number;
|
|
21
|
+
maxLength?: number;
|
|
22
|
+
maxHeight?: number;
|
|
23
|
+
maxWidth?: number;
|
|
24
|
+
hasLeveler?: boolean;
|
|
25
|
+
hasCanopy?: boolean;
|
|
26
|
+
hasRefrigeration?: boolean;
|
|
27
|
+
hasLiveLoad?: boolean;
|
|
28
|
+
currentAppointment?: ObjectId;
|
|
29
|
+
currentVehicle?: string;
|
|
30
|
+
occupiedSince?: Date;
|
|
31
|
+
coordinates?: {
|
|
32
|
+
x?: number;
|
|
33
|
+
y?: number;
|
|
34
|
+
};
|
|
35
|
+
note?: string;
|
|
36
|
+
active?: boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IDefaultFields } from "./IDefaultFields";
|
|
2
|
+
/**
|
|
3
|
+
* Dock Appointment — scheduled time slot at a dock for a delivery or pickup.
|
|
4
|
+
*
|
|
5
|
+
* Drivers/carriers book a slot in advance; warehouse staff prepare goods
|
|
6
|
+
* accordingly. Reduces yard congestion and idle truck time.
|
|
7
|
+
*
|
|
8
|
+
* Lifecycle: scheduled → confirmed → arrived → loading → completed | no_show | cancelled
|
|
9
|
+
*/
|
|
10
|
+
export interface IDockAppointment extends IDefaultFields {
|
|
11
|
+
_customerID: ObjectId;
|
|
12
|
+
_clientID?: ObjectId[];
|
|
13
|
+
_subID?: ObjectId[];
|
|
14
|
+
nbr?: string;
|
|
15
|
+
dock: ObjectId;
|
|
16
|
+
warehouse: ObjectId;
|
|
17
|
+
type: "receiving" | "shipping";
|
|
18
|
+
status: "scheduled" | "confirmed" | "arrived" | "loading" | "completed" | "no_show" | "cancelled";
|
|
19
|
+
scheduledStart: Date;
|
|
20
|
+
scheduledEnd: Date;
|
|
21
|
+
actualArrival?: Date;
|
|
22
|
+
actualStart?: Date;
|
|
23
|
+
actualEnd?: Date;
|
|
24
|
+
goodsReceipt?: ObjectId;
|
|
25
|
+
supplierOrder?: ObjectId;
|
|
26
|
+
shipping?: ObjectId;
|
|
27
|
+
transportOrder?: ObjectId;
|
|
28
|
+
carrier?: string;
|
|
29
|
+
driverName?: string;
|
|
30
|
+
driverPhone?: string;
|
|
31
|
+
vehicleLicense?: string;
|
|
32
|
+
vehicleType?: string;
|
|
33
|
+
trailerLicense?: string;
|
|
34
|
+
expectedWeight?: number;
|
|
35
|
+
expectedVolume?: number;
|
|
36
|
+
expectedPallets?: number;
|
|
37
|
+
assignedTo?: ObjectId;
|
|
38
|
+
notifiedAt?: Date;
|
|
39
|
+
confirmedAt?: Date;
|
|
40
|
+
note?: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { IDefaultFields } from "./IDefaultFields";
|
|
2
|
+
/**
|
|
3
|
+
* Inventory Adjustment — standalone correction entity with reason and approval workflow.
|
|
4
|
+
*
|
|
5
|
+
* Solves the gap that stock corrections currently happen via free-form
|
|
6
|
+
* IStockLog `kindofmovement` strings without structured reasons, audit trail,
|
|
7
|
+
* or approval requirements.
|
|
8
|
+
*
|
|
9
|
+
* Reason types:
|
|
10
|
+
* - shrinkage: theft / loss / unexplained shortage
|
|
11
|
+
* - damage: physically damaged, unsellable
|
|
12
|
+
* - found: surplus discovered during cycle count
|
|
13
|
+
* - correction: data entry error
|
|
14
|
+
* - obsolescence: expired / discontinued
|
|
15
|
+
* - sample: removed for QC sampling
|
|
16
|
+
* - donation: gifted out
|
|
17
|
+
* - return_to_supplier: defective batch sent back
|
|
18
|
+
* - cycle_count: result of cycle count variance
|
|
19
|
+
*/
|
|
20
|
+
export interface IInventoryAdjustment extends IDefaultFields {
|
|
21
|
+
_customerID: ObjectId;
|
|
22
|
+
_clientID?: ObjectId[];
|
|
23
|
+
_subID?: ObjectId[];
|
|
24
|
+
nbr?: string;
|
|
25
|
+
product: ObjectId;
|
|
26
|
+
productSKU?: string;
|
|
27
|
+
productTitle?: string;
|
|
28
|
+
warehouse: ObjectId;
|
|
29
|
+
storageArea?: ObjectId;
|
|
30
|
+
lot?: ObjectId;
|
|
31
|
+
serialNumbers?: string[];
|
|
32
|
+
qtyBefore: number;
|
|
33
|
+
qtyAfter: number;
|
|
34
|
+
qtyDelta: number;
|
|
35
|
+
unit?: string;
|
|
36
|
+
reason: "shrinkage" | "damage" | "found" | "correction" | "obsolescence" | "sample" | "donation" | "return_to_supplier" | "cycle_count" | "other";
|
|
37
|
+
reasonDescription?: string;
|
|
38
|
+
cycleCount?: ObjectId;
|
|
39
|
+
status: "draft" | "pending_approval" | "approved" | "applied" | "rejected" | "cancelled";
|
|
40
|
+
requiresApproval?: boolean;
|
|
41
|
+
submittedBy?: ObjectId;
|
|
42
|
+
submittedAt?: Date;
|
|
43
|
+
approvedBy?: ObjectId;
|
|
44
|
+
approvedAt?: Date;
|
|
45
|
+
rejectedBy?: ObjectId;
|
|
46
|
+
rejectedAt?: Date;
|
|
47
|
+
rejectedReason?: string;
|
|
48
|
+
appliedAt?: Date;
|
|
49
|
+
stockLogRef?: ObjectId;
|
|
50
|
+
valueImpact?: number;
|
|
51
|
+
costCenter?: ObjectId;
|
|
52
|
+
accountingNbr?: string;
|
|
53
|
+
note?: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IDefaultFields } from "./IDefaultFields";
|
|
2
|
+
/**
|
|
3
|
+
* Pick Wave — bundles multiple PickLists for efficient batch picking.
|
|
4
|
+
*
|
|
5
|
+
* Solves the gap that pickers currently process one PickList at a time —
|
|
6
|
+
* inefficient for warehouses with many small orders. A wave groups orders
|
|
7
|
+
* by zone / route / shipping cutoff so the picker walks the warehouse once.
|
|
8
|
+
*
|
|
9
|
+
* Lifecycle: planned → released (pickers can start) → in_progress → completed | cancelled
|
|
10
|
+
*
|
|
11
|
+
* Wave Strategies:
|
|
12
|
+
* - by_zone: group by warehouse zone (StorageArea cluster)
|
|
13
|
+
* - by_carrier: group by shipping carrier cutoff time
|
|
14
|
+
* - by_priority: group by deadline / priority score
|
|
15
|
+
* - by_product: group by same product (batch picking)
|
|
16
|
+
*/
|
|
17
|
+
export interface IPickWave extends IDefaultFields {
|
|
18
|
+
_customerID: ObjectId;
|
|
19
|
+
_clientID?: ObjectId[];
|
|
20
|
+
_subID?: ObjectId[];
|
|
21
|
+
nbr?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
status: "planned" | "released" | "in_progress" | "completed" | "cancelled";
|
|
24
|
+
warehouse: ObjectId;
|
|
25
|
+
strategy?: "by_zone" | "by_carrier" | "by_priority" | "by_product" | "manual";
|
|
26
|
+
pickLists: ObjectId[];
|
|
27
|
+
assignedTo?: ObjectId[];
|
|
28
|
+
totalLines?: number;
|
|
29
|
+
pickedLines?: number;
|
|
30
|
+
progress?: number;
|
|
31
|
+
totalOrders?: number;
|
|
32
|
+
plannedStart?: Date;
|
|
33
|
+
plannedEnd?: Date;
|
|
34
|
+
releasedAt?: Date;
|
|
35
|
+
startedAt?: Date;
|
|
36
|
+
completedAt?: Date;
|
|
37
|
+
estimatedDuration?: number;
|
|
38
|
+
walkingDistance?: number;
|
|
39
|
+
note?: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { IDefaultFields } from "./IDefaultFields";
|
|
2
|
+
/**
|
|
3
|
+
* Provider identifier for an external trade channel.
|
|
4
|
+
* Add new providers here as integrations land.
|
|
5
|
+
*/
|
|
6
|
+
export type TradeChannelProvider = "aliexpress" | "amazon" | "ebay" | "etsy" | "otto" | "bol" | "kaufland" | "tiktokshop" | "shein";
|
|
7
|
+
export type TradeChannelStatus = "unconfigured" | "connected" | "disconnected" | "error" | "expired";
|
|
8
|
+
/**
|
|
9
|
+
* What this channel can do for the customer. Both flows are independent
|
|
10
|
+
* because some providers expose only one side (e.g. Amazon retail has no
|
|
11
|
+
* public buy API — buy is "scrape" only, sell is full SP-API).
|
|
12
|
+
*/
|
|
13
|
+
export interface ITradeChannelCapabilities {
|
|
14
|
+
canBuy: "api" | "scrape" | "none";
|
|
15
|
+
canSell: "api" | "none";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* One (customer × provider × external account) connection.
|
|
19
|
+
* A customer can have multiple AliExpress accounts, etc. — each is its own
|
|
20
|
+
* TradeChannel row, scoped via externalAccountId.
|
|
21
|
+
*
|
|
22
|
+
* Credentials never live here directly. The `_credential` ObjectId points
|
|
23
|
+
* to the standard Credentials collection (AES-256-CTR encrypted).
|
|
24
|
+
*/
|
|
25
|
+
export interface ITradeChannel extends IDefaultFields {
|
|
26
|
+
_customerID: ObjectId;
|
|
27
|
+
_clientID?: ObjectId[];
|
|
28
|
+
_subID?: ObjectId[];
|
|
29
|
+
provider: TradeChannelProvider;
|
|
30
|
+
/**
|
|
31
|
+
* Provider-side account identifier (e.g. AliExpress login email,
|
|
32
|
+
* Amazon seller ID, eBay user id). Allows multiple accounts per
|
|
33
|
+
* customer × provider. Required for the unique index.
|
|
34
|
+
*/
|
|
35
|
+
externalAccountId: string;
|
|
36
|
+
/** Human-readable label shown in admin-v2 (e.g. "AliExpress (max@firma.de)"). */
|
|
37
|
+
label?: string;
|
|
38
|
+
status: TradeChannelStatus;
|
|
39
|
+
capabilities: ITradeChannelCapabilities;
|
|
40
|
+
/** Reference to encrypted credentials in the Credentials collection. */
|
|
41
|
+
_credential?: ObjectId;
|
|
42
|
+
/** Per-channel sync settings. */
|
|
43
|
+
settings?: {
|
|
44
|
+
/** Whether scraped/imported orders should auto-promote to SupplierOrder. Default false. */
|
|
45
|
+
autoPromote?: boolean;
|
|
46
|
+
/** Sync schedule for the per-provider worker. Default "manual". */
|
|
47
|
+
syncSchedule?: "manual" | "hourly" | "daily" | "weekly";
|
|
48
|
+
/** Default destination warehouse for buy-side dropship orders. */
|
|
49
|
+
defaultWarehouse?: ObjectId;
|
|
50
|
+
};
|
|
51
|
+
/** Last successful sync timestamps per direction. */
|
|
52
|
+
lastSyncedAt?: {
|
|
53
|
+
inbound?: Date;
|
|
54
|
+
outbound?: Date;
|
|
55
|
+
};
|
|
56
|
+
/** Last error message + timestamp from a failed sync run. */
|
|
57
|
+
lastError?: {
|
|
58
|
+
at: Date;
|
|
59
|
+
message: string;
|
|
60
|
+
code?: string;
|
|
61
|
+
};
|
|
62
|
+
/** Free-form provider-specific config (rate limits, marketplace ids, fulfillment templates, etc). */
|
|
63
|
+
providerConfig?: any;
|
|
64
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IDefaultFields } from "./IDefaultFields";
|
|
2
|
+
import { TradeChannelProvider } from "./ITradeChannel";
|
|
3
|
+
/**
|
|
4
|
+
* Channel-level event (not order-level — order events live on the order
|
|
5
|
+
* document itself in `events[]`).
|
|
6
|
+
*
|
|
7
|
+
* Captures: token refreshes, sync runs, webhook receipts, OAuth callbacks,
|
|
8
|
+
* connection tests, errors. Append-only with TTL 90d (set in Mongoose model).
|
|
9
|
+
*/
|
|
10
|
+
export type TradeChannelEventType = "channel-created" | "oauth-started" | "oauth-completed" | "oauth-failed" | "token-refreshed" | "token-refresh-failed" | "sync-started" | "sync-completed" | "sync-failed" | "test-connection" | "webhook-received" | "import-batch" | "disconnected" | "error";
|
|
11
|
+
export type TradeChannelEventSeverity = "info" | "warn" | "error";
|
|
12
|
+
export interface ITradeChannelEvent extends IDefaultFields {
|
|
13
|
+
_customerID: ObjectId;
|
|
14
|
+
_clientID?: ObjectId[];
|
|
15
|
+
_subID?: ObjectId[];
|
|
16
|
+
_channel: ObjectId;
|
|
17
|
+
provider: TradeChannelProvider;
|
|
18
|
+
type: TradeChannelEventType;
|
|
19
|
+
severity: TradeChannelEventSeverity;
|
|
20
|
+
message?: string;
|
|
21
|
+
code?: string;
|
|
22
|
+
/** Optional structured payload (sync stats, webhook body summary, etc). */
|
|
23
|
+
data?: any;
|
|
24
|
+
/** Filled by import endpoint: how many orders the batch touched. */
|
|
25
|
+
counts?: {
|
|
26
|
+
created?: number;
|
|
27
|
+
updated?: number;
|
|
28
|
+
skipped?: number;
|
|
29
|
+
failed?: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { IDefaultFields } from "./IDefaultFields";
|
|
2
|
+
import { TradeChannelProvider } from "./ITradeChannel";
|
|
3
|
+
/**
|
|
4
|
+
* Direction of the order from the customer's perspective.
|
|
5
|
+
* - outbound: WE bought something from the provider (dropship, sourcing).
|
|
6
|
+
* - inbound: WE sold something via the provider (we are the seller).
|
|
7
|
+
*/
|
|
8
|
+
export type TradeChannelOrderDirection = "outbound" | "inbound";
|
|
9
|
+
/**
|
|
10
|
+
* Where this order's data came from.
|
|
11
|
+
* - provider-api: pulled via official API (DS API, SP-API, eBay Sell, Etsy OpenAPI).
|
|
12
|
+
* - plugin-scrape: scraped by the aYOUne Companion browser extension.
|
|
13
|
+
* - provider-webhook: pushed by the provider via webhook.
|
|
14
|
+
* - manual: hand-entered in admin-v2.
|
|
15
|
+
*/
|
|
16
|
+
export type TradeChannelOrderSource = "provider-api" | "plugin-scrape" | "provider-webhook" | "manual";
|
|
17
|
+
export type TradeChannelOrderStatus = "placed" | "paid" | "processing" | "shipped" | "delivered" | "completed" | "cancelled" | "refunded" | "dispute" | "unknown";
|
|
18
|
+
/**
|
|
19
|
+
* Single line item on a trade-channel order. Provider-agnostic.
|
|
20
|
+
* `_product` is filled by the post-import "match-products" worker when
|
|
21
|
+
* the external SKU/product can be linked to a Products entry.
|
|
22
|
+
*/
|
|
23
|
+
export interface ITradeChannelOrderItem {
|
|
24
|
+
externalProductId: string;
|
|
25
|
+
externalSkuId?: string;
|
|
26
|
+
title: string;
|
|
27
|
+
qty: number;
|
|
28
|
+
unitPrice: number;
|
|
29
|
+
lineTotal?: number;
|
|
30
|
+
currency?: string;
|
|
31
|
+
thumbnailUrl?: string;
|
|
32
|
+
productUrl?: string;
|
|
33
|
+
/** Filled when the line item is matched to an internal Product. */
|
|
34
|
+
_product?: ObjectId;
|
|
35
|
+
/** Filled when the line item is matched to an internal SKU. */
|
|
36
|
+
_sku?: ObjectId;
|
|
37
|
+
/** Provider-specific extras (variant attributes, options, etc). */
|
|
38
|
+
attributes?: Record<string, any>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Tracking / shipment data for one parcel on this order.
|
|
42
|
+
*/
|
|
43
|
+
export interface ITradeChannelOrderShipment {
|
|
44
|
+
carrier?: string;
|
|
45
|
+
trackingNumber?: string;
|
|
46
|
+
trackingUrl?: string;
|
|
47
|
+
shippedAt?: Date;
|
|
48
|
+
estimatedDelivery?: Date;
|
|
49
|
+
deliveredAt?: Date;
|
|
50
|
+
status?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Append-only event log entry on the order. Captures every meaningful
|
|
54
|
+
* change so we can audit who-changed-what across the api/scraper/webhook
|
|
55
|
+
* pipelines and de-duplicate confidently.
|
|
56
|
+
*/
|
|
57
|
+
export interface ITradeChannelOrderEvent {
|
|
58
|
+
at: Date;
|
|
59
|
+
source: TradeChannelOrderSource;
|
|
60
|
+
type: string;
|
|
61
|
+
data?: any;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Full shipping address record. Stored in full per the user's choice
|
|
65
|
+
* (no hashing) — required for fulfillment on the sell side and for
|
|
66
|
+
* dropship destination on the buy side.
|
|
67
|
+
*/
|
|
68
|
+
export interface ITradeChannelAddress {
|
|
69
|
+
company?: string;
|
|
70
|
+
salutation?: string;
|
|
71
|
+
firstName?: string;
|
|
72
|
+
lastName?: string;
|
|
73
|
+
street?: string;
|
|
74
|
+
houseNumber?: string;
|
|
75
|
+
addressAdditional?: string;
|
|
76
|
+
zip?: string;
|
|
77
|
+
city?: string;
|
|
78
|
+
state?: string;
|
|
79
|
+
country?: string;
|
|
80
|
+
countryCode?: string;
|
|
81
|
+
phone?: string;
|
|
82
|
+
email?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* One order flowing through a trade channel — bidirectional via `direction`.
|
|
86
|
+
* Unique per (customerId, _channel, externalId) so the same provider order
|
|
87
|
+
* id can never be inserted twice regardless of which pipeline reported it.
|
|
88
|
+
*/
|
|
89
|
+
export interface ITradeChannelOrder extends IDefaultFields {
|
|
90
|
+
_customerID: ObjectId;
|
|
91
|
+
_clientID?: ObjectId[];
|
|
92
|
+
_subID?: ObjectId[];
|
|
93
|
+
/** Reference to the TradeChannel this order flows through. */
|
|
94
|
+
_channel: ObjectId;
|
|
95
|
+
/** Cached provider for fast queries without joining _channel. */
|
|
96
|
+
provider: TradeChannelProvider;
|
|
97
|
+
direction: TradeChannelOrderDirection;
|
|
98
|
+
source: TradeChannelOrderSource;
|
|
99
|
+
/** Provider-side order id. Unique within (_customerID, _channel). */
|
|
100
|
+
externalId: string;
|
|
101
|
+
externalUrl?: string;
|
|
102
|
+
status: TradeChannelOrderStatus;
|
|
103
|
+
/** Raw provider status string before normalization. */
|
|
104
|
+
rawStatus?: string;
|
|
105
|
+
orderDate: Date;
|
|
106
|
+
currency: string;
|
|
107
|
+
subtotal?: number;
|
|
108
|
+
shippingTotal?: number;
|
|
109
|
+
taxTotal?: number;
|
|
110
|
+
discountTotal?: number;
|
|
111
|
+
total: number;
|
|
112
|
+
/** Counterparty: the seller on outbound (we bought from them) or the buyer on inbound (we sold to them). */
|
|
113
|
+
counterparty?: {
|
|
114
|
+
externalId?: string;
|
|
115
|
+
name?: string;
|
|
116
|
+
storeUrl?: string;
|
|
117
|
+
email?: string;
|
|
118
|
+
};
|
|
119
|
+
/** Shipping address — full record per user choice (no hashing). */
|
|
120
|
+
shippingAddress?: ITradeChannelAddress;
|
|
121
|
+
/** Billing address if it differs. */
|
|
122
|
+
billingAddress?: ITradeChannelAddress;
|
|
123
|
+
items: ITradeChannelOrderItem[];
|
|
124
|
+
shipments?: ITradeChannelOrderShipment[];
|
|
125
|
+
events?: ITradeChannelOrderEvent[];
|
|
126
|
+
/** First time this order was seen by aYOUne (set on insert, never updated). */
|
|
127
|
+
firstSeenAt: Date;
|
|
128
|
+
firstSeenSource: TradeChannelOrderSource;
|
|
129
|
+
/** Last time any pipeline touched this order. */
|
|
130
|
+
lastSyncedAt?: Date;
|
|
131
|
+
/** When this order was promoted into a SupplierOrder (manual action only). */
|
|
132
|
+
promotedAt?: Date;
|
|
133
|
+
/** The SupplierOrder created from this trade-channel order, if promoted. */
|
|
134
|
+
_supplierOrder?: ObjectId;
|
|
135
|
+
/** The IncomeInvoice linked to the promotion, if any. */
|
|
136
|
+
_incomeInvoice?: ObjectId;
|
|
137
|
+
/** The GoodsReceipt linked to the promotion, if any. */
|
|
138
|
+
_goodsReceipt?: ObjectId;
|
|
139
|
+
/** Last raw payload from the provider/scraper, for debugging + diffing. */
|
|
140
|
+
raw?: any;
|
|
141
|
+
/** Free-form notes (admin-entered). */
|
|
142
|
+
note?: string;
|
|
143
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IDefaultFields } from "./IDefaultFields";
|
|
2
|
+
/**
|
|
3
|
+
* Transport Order — staging entity that bundles one or more shipments
|
|
4
|
+
* for a single carrier pickup.
|
|
5
|
+
*
|
|
6
|
+
* Solves the gap that IShipping goes directly to a carrier with no
|
|
7
|
+
* intermediate stop for route optimization, multi-stop tours, or
|
|
8
|
+
* carrier handoff documentation (Bill of Lading equivalent).
|
|
9
|
+
*
|
|
10
|
+
* Lifecycle: planned → confirmed → ready → in_transit → delivered | cancelled
|
|
11
|
+
*/
|
|
12
|
+
export interface ITransportOrder extends IDefaultFields {
|
|
13
|
+
_customerID: ObjectId;
|
|
14
|
+
_clientID?: ObjectId[];
|
|
15
|
+
_subID?: ObjectId[];
|
|
16
|
+
nbr?: string;
|
|
17
|
+
referenceNumber?: string;
|
|
18
|
+
bolNumber?: string;
|
|
19
|
+
status: "planned" | "confirmed" | "ready" | "in_transit" | "delivered" | "cancelled";
|
|
20
|
+
shippings: ObjectId[];
|
|
21
|
+
carrier?: string;
|
|
22
|
+
carrierAccount?: string;
|
|
23
|
+
serviceLevel?: string;
|
|
24
|
+
plannedPickup?: Date;
|
|
25
|
+
actualPickup?: Date;
|
|
26
|
+
plannedDelivery?: Date;
|
|
27
|
+
estimatedDelivery?: Date;
|
|
28
|
+
actualDelivery?: Date;
|
|
29
|
+
tourNumber?: string;
|
|
30
|
+
stopSequence?: number;
|
|
31
|
+
totalStops?: number;
|
|
32
|
+
pickupDock?: ObjectId;
|
|
33
|
+
pickupAppointment?: ObjectId;
|
|
34
|
+
deliveryAddress?: {
|
|
35
|
+
company?: string;
|
|
36
|
+
street?: string;
|
|
37
|
+
zip?: string;
|
|
38
|
+
city?: string;
|
|
39
|
+
country?: string;
|
|
40
|
+
};
|
|
41
|
+
driverName?: string;
|
|
42
|
+
driverPhone?: string;
|
|
43
|
+
vehicleLicense?: string;
|
|
44
|
+
trailerLicense?: string;
|
|
45
|
+
totalWeight?: number;
|
|
46
|
+
totalVolume?: number;
|
|
47
|
+
totalPackages?: number;
|
|
48
|
+
totalPallets?: number;
|
|
49
|
+
trackingNumber?: string;
|
|
50
|
+
trackingUrl?: string;
|
|
51
|
+
bolUrl?: string;
|
|
52
|
+
cmrUrl?: string;
|
|
53
|
+
sealNumbers?: string[];
|
|
54
|
+
transportCost?: number;
|
|
55
|
+
fuelSurcharge?: number;
|
|
56
|
+
accessoryCharges?: number;
|
|
57
|
+
totalCost?: number;
|
|
58
|
+
currency?: string;
|
|
59
|
+
note?: string;
|
|
60
|
+
}
|
package/interfaces/index.d.ts
CHANGED
|
@@ -270,6 +270,8 @@ export * from "./IDesktopClient";
|
|
|
270
270
|
export * from "./IDesktopNotification";
|
|
271
271
|
export * from "./IDiscountGroup";
|
|
272
272
|
export * from "./IDMCampaign";
|
|
273
|
+
export * from "./IDock";
|
|
274
|
+
export * from "./IDockAppointment";
|
|
273
275
|
export * from "./IDocument";
|
|
274
276
|
export * from "./IDoi";
|
|
275
277
|
export * from "./IDoiLog";
|
|
@@ -373,6 +375,7 @@ export * from "./IIntermediary";
|
|
|
373
375
|
export * from "./IInternalChatMessage";
|
|
374
376
|
export * from "./IInternalForm";
|
|
375
377
|
export * from "./IInternalOrder";
|
|
378
|
+
export * from "./IInventoryAdjustment";
|
|
376
379
|
export * from "./IInventoryList";
|
|
377
380
|
export * from "./IInvoice";
|
|
378
381
|
export * from "./IIoTDevice";
|
|
@@ -480,6 +483,7 @@ export * from "./IPaymentGroup";
|
|
|
480
483
|
export * from "./IPaymentProvider";
|
|
481
484
|
export * from "./IPermissionRequest";
|
|
482
485
|
export * from "./IPickList";
|
|
486
|
+
export * from "./IPickWave";
|
|
483
487
|
export * from "./IPimSelection";
|
|
484
488
|
export * from "./IPipeline";
|
|
485
489
|
export * from "./IPoints";
|
|
@@ -649,7 +653,11 @@ export * from "./ITicket";
|
|
|
649
653
|
export * from "./ITip";
|
|
650
654
|
export * from "./ITitle";
|
|
651
655
|
export * from "./ITrade";
|
|
656
|
+
export * from "./ITradeChannel";
|
|
657
|
+
export * from "./ITradeChannelEvent";
|
|
658
|
+
export * from "./ITradeChannelOrder";
|
|
652
659
|
export * from "./ITransaction";
|
|
660
|
+
export * from "./ITransportOrder";
|
|
653
661
|
export * from "./ITravel";
|
|
654
662
|
export * from "./ITrigger";
|
|
655
663
|
export * from "./ITriggerAction";
|
package/interfaces/index.js
CHANGED
|
@@ -286,6 +286,8 @@ __exportStar(require("./IDesktopClient"), exports);
|
|
|
286
286
|
__exportStar(require("./IDesktopNotification"), exports);
|
|
287
287
|
__exportStar(require("./IDiscountGroup"), exports);
|
|
288
288
|
__exportStar(require("./IDMCampaign"), exports);
|
|
289
|
+
__exportStar(require("./IDock"), exports);
|
|
290
|
+
__exportStar(require("./IDockAppointment"), exports);
|
|
289
291
|
__exportStar(require("./IDocument"), exports);
|
|
290
292
|
__exportStar(require("./IDoi"), exports);
|
|
291
293
|
__exportStar(require("./IDoiLog"), exports);
|
|
@@ -389,6 +391,7 @@ __exportStar(require("./IIntermediary"), exports);
|
|
|
389
391
|
__exportStar(require("./IInternalChatMessage"), exports);
|
|
390
392
|
__exportStar(require("./IInternalForm"), exports);
|
|
391
393
|
__exportStar(require("./IInternalOrder"), exports);
|
|
394
|
+
__exportStar(require("./IInventoryAdjustment"), exports);
|
|
392
395
|
__exportStar(require("./IInventoryList"), exports);
|
|
393
396
|
__exportStar(require("./IInvoice"), exports);
|
|
394
397
|
__exportStar(require("./IIoTDevice"), exports);
|
|
@@ -496,6 +499,7 @@ __exportStar(require("./IPaymentGroup"), exports);
|
|
|
496
499
|
__exportStar(require("./IPaymentProvider"), exports);
|
|
497
500
|
__exportStar(require("./IPermissionRequest"), exports);
|
|
498
501
|
__exportStar(require("./IPickList"), exports);
|
|
502
|
+
__exportStar(require("./IPickWave"), exports);
|
|
499
503
|
__exportStar(require("./IPimSelection"), exports);
|
|
500
504
|
__exportStar(require("./IPipeline"), exports);
|
|
501
505
|
__exportStar(require("./IPoints"), exports);
|
|
@@ -665,7 +669,11 @@ __exportStar(require("./ITicket"), exports);
|
|
|
665
669
|
__exportStar(require("./ITip"), exports);
|
|
666
670
|
__exportStar(require("./ITitle"), exports);
|
|
667
671
|
__exportStar(require("./ITrade"), exports);
|
|
672
|
+
__exportStar(require("./ITradeChannel"), exports);
|
|
673
|
+
__exportStar(require("./ITradeChannelEvent"), exports);
|
|
674
|
+
__exportStar(require("./ITradeChannelOrder"), exports);
|
|
668
675
|
__exportStar(require("./ITransaction"), exports);
|
|
676
|
+
__exportStar(require("./ITransportOrder"), exports);
|
|
669
677
|
__exportStar(require("./ITravel"), exports);
|
|
670
678
|
__exportStar(require("./ITrigger"), exports);
|
|
671
679
|
__exportStar(require("./ITriggerAction"), exports);
|