@secondcloset/types 2.8.0 → 2.9.0-beta.1
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/package.json +1 -1
- package/src/fulfillment/order/order.ts +41 -38
- package/src/fulfillment/order/orderItem.ts +32 -14
- package/src/fulfillment/product/product.ts +10 -13
- package/src/fulfillment/shipment/shipment.ts +45 -37
- package/src/fulfillment/shipment/shipmentItem.ts +52 -39
- package/src/warehouse/carrierTransferPackage.ts +2 -2
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
BaseUser,
|
|
7
7
|
Organization,
|
|
8
8
|
File,
|
|
9
|
+
Version,
|
|
9
10
|
} from "../../_common";
|
|
10
11
|
import { OrderItem } from "./orderItem";
|
|
11
12
|
|
|
@@ -44,41 +45,43 @@ export interface FulfillmentOrderAddress extends BaseAddress {
|
|
|
44
45
|
updated_at: string;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
48
|
+
export type Order<V extends Version = "V1"> = V extends "V1"
|
|
49
|
+
? {
|
|
50
|
+
id: string;
|
|
51
|
+
order_id: string;
|
|
52
|
+
external_order_number: string;
|
|
53
|
+
external_order_id: string | null;
|
|
54
|
+
notes: string;
|
|
55
|
+
internal_notes?: string;
|
|
56
|
+
platform: OrderPlatform;
|
|
57
|
+
external_platform_version: number | null;
|
|
58
|
+
parcel_type: string;
|
|
59
|
+
cancelled: boolean;
|
|
60
|
+
fulfilled_from: FacilityCode;
|
|
61
|
+
client_type: string | null;
|
|
62
|
+
insurance_value: number;
|
|
63
|
+
shipping_service: string | null;
|
|
64
|
+
signature_required?: boolean;
|
|
65
|
+
customer: Customer;
|
|
66
|
+
address: FulfillmentOrderAddress;
|
|
67
|
+
created_at: string;
|
|
68
|
+
updated_at: string;
|
|
69
|
+
organization: Organization;
|
|
70
|
+
overdue: boolean;
|
|
71
|
+
user: BaseUser;
|
|
72
|
+
status?: string;
|
|
73
|
+
shipment_tags: ShipmentTag[];
|
|
74
|
+
shipments: Shipment<V>[];
|
|
75
|
+
items: OrderItem<V>[];
|
|
76
|
+
files: File[];
|
|
77
|
+
stock_status:
|
|
78
|
+
| "in_stock"
|
|
79
|
+
| "partially_in_stock"
|
|
80
|
+
| "out_of_stock"
|
|
81
|
+
| "unknown_stock";
|
|
82
|
+
on_hold: boolean;
|
|
83
|
+
on_hold_at: string;
|
|
84
|
+
requested_service_code?: ScServiceCode;
|
|
85
|
+
has_errors: boolean;
|
|
86
|
+
}
|
|
87
|
+
: Omit<Order<"V1">, "items" | "shipments">;
|
|
@@ -1,16 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Version } from "../../_common";
|
|
2
|
+
import { BaseProduct, Product } from "../product";
|
|
2
3
|
import { ShipmentActionType } from "../shipment";
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
export type OrderItem<V extends Version = "V1"> = V extends "V1"
|
|
6
|
+
? {
|
|
7
|
+
id: string;
|
|
8
|
+
product: Product;
|
|
9
|
+
quantity: number;
|
|
10
|
+
attributes: string[];
|
|
11
|
+
return_reasons: string[];
|
|
12
|
+
available_actions: ShipmentActionType[];
|
|
13
|
+
actions_history: ShipmentActionType[];
|
|
14
|
+
virtual_kit_id: null | string;
|
|
15
|
+
available_quantity: number;
|
|
16
|
+
removed: boolean;
|
|
17
|
+
removed_reason: string;
|
|
18
|
+
}
|
|
19
|
+
: {
|
|
20
|
+
product: BaseProduct & {
|
|
21
|
+
available_quantity: OrderItem<"V1">["available_quantity"];
|
|
22
|
+
base_products?: OrderItem<"V2">["product"][];
|
|
23
|
+
required_parts?: Record<string, number>;
|
|
24
|
+
};
|
|
25
|
+
available_actions: {
|
|
26
|
+
inventory_pick_up_item_ids: OrderItem<"V1">["id"][];
|
|
27
|
+
inventory_warehouse_receiving_item_ids: OrderItem<"V1">["id"][];
|
|
28
|
+
delivery_item_ids: OrderItem<"V1">["id"][];
|
|
29
|
+
};
|
|
30
|
+
removed_items: {
|
|
31
|
+
removed_reason: string;
|
|
32
|
+
quantity: number;
|
|
33
|
+
}[];
|
|
34
|
+
};
|
|
@@ -3,14 +3,18 @@ import { BaseImage } from "../../_common";
|
|
|
3
3
|
|
|
4
4
|
export interface BaseProduct {
|
|
5
5
|
id: string;
|
|
6
|
-
organization_id: string;
|
|
7
6
|
scid: string;
|
|
7
|
+
name: string;
|
|
8
8
|
sku: string;
|
|
9
9
|
upc: string;
|
|
10
|
-
|
|
10
|
+
type: "base" | "kit";
|
|
11
|
+
active: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Product extends Omit<BaseProduct, "type"> {
|
|
15
|
+
organization_id: string;
|
|
11
16
|
description: string;
|
|
12
17
|
platform: string;
|
|
13
|
-
active: boolean;
|
|
14
18
|
fragile: boolean;
|
|
15
19
|
dangerous: boolean;
|
|
16
20
|
liquid: boolean;
|
|
@@ -32,7 +36,7 @@ export interface BaseProduct {
|
|
|
32
36
|
customs_description: string | null;
|
|
33
37
|
images: BaseImage[];
|
|
34
38
|
packaging_criteria: string;
|
|
35
|
-
product_type: "
|
|
39
|
+
product_type: BaseProduct["type"];
|
|
36
40
|
stocks?: Stock[];
|
|
37
41
|
deleted_at: string;
|
|
38
42
|
created_at: string;
|
|
@@ -56,21 +60,14 @@ export interface BaseProduct {
|
|
|
56
60
|
insurance_value: number | null;
|
|
57
61
|
has_errors: boolean;
|
|
58
62
|
under_conversion: boolean;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export interface Product extends BaseProduct {
|
|
62
|
-
base_products?: BaseProduct[];
|
|
63
|
+
base_products?: Product[];
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
export interface PackagingLevel {
|
|
66
67
|
id?: string;
|
|
67
68
|
product_id?: string;
|
|
68
|
-
product: {
|
|
69
|
-
id: string;
|
|
70
|
-
sku: string;
|
|
69
|
+
product: BaseProduct & {
|
|
71
70
|
upc: string;
|
|
72
|
-
scid: string;
|
|
73
|
-
name: string;
|
|
74
71
|
tracks_lot_numbers: boolean;
|
|
75
72
|
};
|
|
76
73
|
level: "single_item" | "inner_pack" | "master_pack" | "pallet";
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ShipmentItem } from "./shipmentItem";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
BaseUser,
|
|
4
|
+
BaseNote,
|
|
5
|
+
BaseOrganization,
|
|
6
|
+
Facility,
|
|
7
|
+
Version,
|
|
8
|
+
} from "../../_common";
|
|
3
9
|
import { Package } from "./package";
|
|
4
10
|
import {
|
|
5
11
|
SecondClosetShippingMethod,
|
|
@@ -35,39 +41,41 @@ export type ScServiceCode =
|
|
|
35
41
|
| "second_closet_to_the_door_1_person"
|
|
36
42
|
| ServiceCode;
|
|
37
43
|
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
44
|
+
export type Shipment<V extends Version = "V1"> = V extends "V1"
|
|
45
|
+
? {
|
|
46
|
+
id: string;
|
|
47
|
+
organization_id: string;
|
|
48
|
+
organization?: BaseOrganization;
|
|
49
|
+
billed: boolean;
|
|
50
|
+
user: BaseUser;
|
|
51
|
+
notes: BaseNote[] | string;
|
|
52
|
+
shipment_items: ShipmentItem<V>[];
|
|
53
|
+
shipment_number: string;
|
|
54
|
+
packages: Package[];
|
|
55
|
+
external_order_id: string | null;
|
|
56
|
+
external_order_type: string;
|
|
57
|
+
external_shipment_id: string | null;
|
|
58
|
+
carrier: Carrier | null;
|
|
59
|
+
created_at: string;
|
|
60
|
+
updated_at: string;
|
|
61
|
+
action_summary: ShipmentActionType[];
|
|
62
|
+
freight: boolean;
|
|
63
|
+
shipping_method:
|
|
64
|
+
| SecondClosetShippingMethod
|
|
65
|
+
| ExternalCarrierShippingMethod
|
|
66
|
+
| CustomerPickupShippingMethod;
|
|
67
|
+
shipping_method_type:
|
|
68
|
+
| "external_carrier_shipment"
|
|
69
|
+
| "appointment"
|
|
70
|
+
| "untracked_shipment"
|
|
71
|
+
| "customer_pickup_shipment";
|
|
72
|
+
external_order?: {
|
|
73
|
+
id: string;
|
|
74
|
+
external_order_number: string;
|
|
75
|
+
external_order_id: string | null;
|
|
76
|
+
created_at: string;
|
|
77
|
+
updated_at: string;
|
|
78
|
+
};
|
|
79
|
+
facility?: Partial<Facility>;
|
|
80
|
+
}
|
|
81
|
+
: Omit<Shipment<"V1">, "shipment_items">;
|
|
@@ -1,42 +1,55 @@
|
|
|
1
|
+
import { Version } from "../../_common";
|
|
2
|
+
import { BaseProduct } from "../product";
|
|
1
3
|
import { ShipmentActionType } from "./shipment";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
export type ShipmentItem<V extends Version = "V1"> = V extends "V1"
|
|
5
|
+
? {
|
|
6
|
+
id: string;
|
|
7
|
+
order_item_id: string;
|
|
8
|
+
description: string;
|
|
9
|
+
item_identifier: string;
|
|
10
|
+
item_identifier_type: string;
|
|
11
|
+
item_identifier_value: string;
|
|
12
|
+
product_id?: string;
|
|
13
|
+
weight_value: string;
|
|
14
|
+
weight_unit: string;
|
|
15
|
+
length_value: string;
|
|
16
|
+
length_unit: string;
|
|
17
|
+
height_value: string;
|
|
18
|
+
height_unit: string;
|
|
19
|
+
width_value: string;
|
|
20
|
+
width_unit: string;
|
|
21
|
+
shipment_actions: ShipmentActionType[];
|
|
22
|
+
shipment_actions_completion: Partial<
|
|
23
|
+
{
|
|
24
|
+
[key in ShipmentActionType]: boolean;
|
|
25
|
+
}
|
|
26
|
+
>;
|
|
27
|
+
shipment_actions_status?: {
|
|
28
|
+
[key in ShipmentActionType]: {
|
|
29
|
+
completed: boolean;
|
|
30
|
+
failed: boolean;
|
|
31
|
+
failed_reason: string | null;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
shipment_item_group: {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
external_group_id: string;
|
|
39
|
+
group_identifier_type: string;
|
|
40
|
+
group_identifier_value: string;
|
|
41
|
+
created_at: string;
|
|
42
|
+
updated_at: string;
|
|
43
|
+
group_identifier: string;
|
|
44
|
+
} | null;
|
|
22
45
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
46
|
+
: {
|
|
47
|
+
product: BaseProduct;
|
|
48
|
+
shipment_item_ids: ShipmentItem<"V1">["id"][];
|
|
49
|
+
shipment_actions_status: {
|
|
50
|
+
[key in ShipmentActionType]: {
|
|
51
|
+
completed_shipment_item_ids: string[];
|
|
52
|
+
failed_shipment_items: string[];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
29
55
|
};
|
|
30
|
-
};
|
|
31
|
-
shipment_item_group: {
|
|
32
|
-
id: string;
|
|
33
|
-
name: string;
|
|
34
|
-
description: string;
|
|
35
|
-
external_group_id: string;
|
|
36
|
-
group_identifier_type: string;
|
|
37
|
-
group_identifier_value: string;
|
|
38
|
-
created_at: string;
|
|
39
|
-
updated_at: string;
|
|
40
|
-
group_identifier: string;
|
|
41
|
-
} | null;
|
|
42
|
-
}
|
|
@@ -43,7 +43,7 @@ interface ShippingLabel extends Partial<ExternalCarrierShippingLabel> {
|
|
|
43
43
|
created_at: string;
|
|
44
44
|
updated_at: string;
|
|
45
45
|
}
|
|
46
|
-
interface PackageShipment extends Partial<Shipment
|
|
46
|
+
interface PackageShipment extends Partial<Shipment<"V1">> {
|
|
47
47
|
user_id: string;
|
|
48
48
|
shipping_method_id?: string;
|
|
49
49
|
customer_scheduling_token?: string;
|
|
@@ -62,4 +62,4 @@ export interface PackageDetailsInfo extends PackageInfo {
|
|
|
62
62
|
organization: Organization;
|
|
63
63
|
carrier?: PackageCarrier;
|
|
64
64
|
shipping_label?: ShippingLabel;
|
|
65
|
-
}
|
|
65
|
+
}
|