Skip to content

Commit b58e280

Browse files
authored
Fedex - new components (#19385)
* new components * versions * update
1 parent e061bd2 commit b58e280

File tree

8 files changed

+289
-3
lines changed

8 files changed

+289
-3
lines changed

components/fedex/actions/create-shipment/create-shipment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "fedex-create-shipment",
55
name: "Create Shipment",
66
description: "Create a new shipment. [See the documentation](https://developer.fedex.com/api/en-us/catalog/ship/docs.html#operation/Create%20Shipment)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import fedex from "../../fedex.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "fedex-track-by-reference",
6+
name: "Track by Reference",
7+
description: "Tracks a package by reference number. [See the documentation](https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html#operation/Track%20by%20References)",
8+
version: "0.0.1",
9+
type: "action",
10+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: true,
14+
},
15+
props: {
16+
fedex,
17+
value: {
18+
type: "string",
19+
label: "Reference Value",
20+
description: "The reference value to track",
21+
},
22+
accountNumber: {
23+
type: "string",
24+
label: "Account Number",
25+
description: "The shipper's account number. Either `accountNumber` or `destinationPostalCode` and `destinationCountryCode` must be provided.",
26+
optional: true,
27+
},
28+
destinationPostalCode: {
29+
type: "string",
30+
label: "Destination Postal Code",
31+
description: "The postal code of the destination. Either `accountNumber` or `destinationPostalCode` and `destinationCountryCode` must be provided.",
32+
optional: true,
33+
},
34+
destinationCountryCode: {
35+
type: "string",
36+
label: "Destination Country Code",
37+
description: "The country code of the destination. Either `accountNumber` or `destinationPostalCode` and `destinationCountryCode` must be provided.",
38+
optional: true,
39+
},
40+
shipDateBegin: {
41+
propDefinition: [
42+
fedex,
43+
"shipDateBegin",
44+
],
45+
},
46+
shipDateEnd: {
47+
propDefinition: [
48+
fedex,
49+
"shipDateEnd",
50+
],
51+
},
52+
includeDetailedScans: {
53+
propDefinition: [
54+
fedex,
55+
"includeDetailedScans",
56+
],
57+
},
58+
},
59+
async run({ $ }) {
60+
if (!this.accountNumber && (!this.destinationPostalCode || !this.destinationCountryCode)) {
61+
throw new ConfigurationError("Either `accountNumber` or `destinationPostalCode` and `destinationCountryCode` must be provided.");
62+
}
63+
const response = await this.fedex.trackByReference({
64+
$,
65+
data: {
66+
referencesInformation: {
67+
value: this.value,
68+
accountNumber: this.accountNumber,
69+
destinationPostalCode: this.destinationPostalCode,
70+
destinationCountryCode: this.destinationCountryCode,
71+
shipDateBegin: this.shipDateBegin,
72+
shipDateEnd: this.shipDateEnd,
73+
},
74+
includeDetailedScans: this.includeDetailedScans,
75+
},
76+
});
77+
$.export("$summary", `Tracking information for ${this.value} retrieved successfully`);
78+
return response;
79+
},
80+
};
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import fedex from "../../fedex.app.mjs";
2+
3+
export default {
4+
key: "fedex-track-by-tcn",
5+
name: "Track by TCN",
6+
description: "Tracks a package by transportation control number. [See the documentation](https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html#operation/f1f9080e8452d9ac903f562a2d2626d0)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
fedex,
16+
value: {
17+
type: "string",
18+
label: "Transportation Control Number",
19+
description: "The transportation control number to track",
20+
},
21+
shipDateBegin: {
22+
propDefinition: [
23+
fedex,
24+
"shipDateBegin",
25+
],
26+
},
27+
shipDateEnd: {
28+
propDefinition: [
29+
fedex,
30+
"shipDateEnd",
31+
],
32+
},
33+
includeDetailedScans: {
34+
propDefinition: [
35+
fedex,
36+
"includeDetailedScans",
37+
],
38+
},
39+
},
40+
async run({ $ }) {
41+
const response = await this.fedex.trackByTrackingControlNumber({
42+
$,
43+
data: {
44+
tcnInfo: {
45+
value: this.value,
46+
shipDateBegin: this.shipDateBegin,
47+
shipDateEnd: this.shipDateEnd,
48+
},
49+
includeDetailedScans: this.includeDetailedScans,
50+
},
51+
});
52+
$.export("$summary", `Tracking information for ${this.value} retrieved successfully`);
53+
return response;
54+
},
55+
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import fedex from "../../fedex.app.mjs";
2+
3+
export default {
4+
key: "fedex-track-by-tracking-number",
5+
name: "Track by Tracking Number",
6+
description: "Tracks a package by tracking number. [See the documentation](https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html#operation/Track%20by%20Tracking%20Number)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
fedex,
16+
trackingNumber: {
17+
propDefinition: [
18+
fedex,
19+
"trackingNumber",
20+
],
21+
},
22+
includeDetailedScans: {
23+
propDefinition: [
24+
fedex,
25+
"includeDetailedScans",
26+
],
27+
},
28+
},
29+
async run({ $ }) {
30+
const response = await this.fedex.trackByTrackingNumber({
31+
$,
32+
data: {
33+
trackingInfo: [
34+
{
35+
trackingNumberInfo: {
36+
trackingNumber: this.trackingNumber,
37+
},
38+
},
39+
],
40+
includeDetailedScans: this.includeDetailedScans,
41+
},
42+
});
43+
$.export("$summary", `Tracking information for ${this.trackingNumber} retrieved successfully`);
44+
return response;
45+
},
46+
};
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import fedex from "../../fedex.app.mjs";
2+
3+
export default {
4+
key: "fedex-track-multi-piece-shipment",
5+
name: "Track Multi-Piece Shipment",
6+
description: "Tracks a multi-piece shipment. [See the documentation](https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html#operation/Track%20Multiple%20Piece%20Shipment)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
fedex,
16+
associatedType: {
17+
type: "string",
18+
label: "Associated Type",
19+
description: "The associated shipment type, such as MPS, Group MPS, or an outbound shipment which is linked to a return shipment",
20+
options: [
21+
"OUTBOUND_LINK_TO_RETURN",
22+
"STANDARD_MPS",
23+
"GROUP_MPS",
24+
],
25+
},
26+
trackingNumber: {
27+
propDefinition: [
28+
fedex,
29+
"trackingNumber",
30+
],
31+
},
32+
includeDetailedScans: {
33+
propDefinition: [
34+
fedex,
35+
"includeDetailedScans",
36+
],
37+
},
38+
},
39+
async run({ $ }) {
40+
const response = await this.fedex.trackMultiplePieceShipment({
41+
$,
42+
data: {
43+
associatedType: this.associatedType,
44+
masterTrackingNumberInfo: {
45+
trackingNumberInfo: {
46+
trackingNumber: this.trackingNumber,
47+
},
48+
},
49+
includeDetailedScans: this.includeDetailedScans,
50+
},
51+
});
52+
$.export("$summary", `Tracking information for ${this.trackingNumber} retrieved successfully`);
53+
return response;
54+
},
55+
};

components/fedex/actions/validate-shipment/validate-shipment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "fedex-validate-shipment",
55
name: "Validate Shipment",
66
description: "Validate a shipment. [See the documentation](https://developer.fedex.com/api/en-us/catalog/ship/docs.html#operation/ShipmentPackageValidate)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/fedex/fedex.app.mjs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,28 @@ export default {
178178
label: "Weights",
179179
description: "An array of weight values for each of the requested pieces of the shipment",
180180
},
181+
trackingNumber: {
182+
type: "string",
183+
label: "Tracking Number",
184+
description: "The tracking number to track",
185+
},
186+
includeDetailedScans: {
187+
type: "boolean",
188+
label: "Include Detailed Scans",
189+
description: "Indicates whether to include detailed scan information in the response",
190+
default: false,
191+
optional: true,
192+
},
193+
shipDateBegin: {
194+
type: "string",
195+
label: "Ship Date Begin",
196+
description: "The beginning of the ship date range to track. Format: YYYY-MM-DD",
197+
},
198+
shipDateEnd: {
199+
type: "string",
200+
label: "Ship Date End",
201+
description: "The end of the ship date range to track. Format: YYYY-MM-DD",
202+
},
181203
},
182204
methods: {
183205
_baseUrl() {
@@ -208,5 +230,33 @@ export default {
208230
...opts,
209231
});
210232
},
233+
trackByTrackingNumber(opts = {}) {
234+
return this._makeRequest({
235+
path: "/track/v1/trackingnumbers",
236+
method: "POST",
237+
...opts,
238+
});
239+
},
240+
trackByReference(opts = {}) {
241+
return this._makeRequest({
242+
path: "/track/v1/referencenumbers",
243+
method: "POST",
244+
...opts,
245+
});
246+
},
247+
trackByTrackingControlNumber(opts = {}) {
248+
return this._makeRequest({
249+
path: "/track/v1/tcn",
250+
method: "POST",
251+
...opts,
252+
});
253+
},
254+
trackMultiplePieceShipment(opts = {}) {
255+
return this._makeRequest({
256+
path: "/track/v1/associatedshipments",
257+
method: "POST",
258+
...opts,
259+
});
260+
},
211261
},
212262
};

components/fedex/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/fedex",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream FedEx Components",
55
"main": "fedex.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)