n8n-nodes-ups 0.2.2
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/LICENSE +21 -0
- package/README.md +103 -0
- package/dist/credentials/UpsOAuth2Api.credentials.d.ts +10 -0
- package/dist/credentials/UpsOAuth2Api.credentials.js +76 -0
- package/dist/credentials/UpsOAuth2Api.credentials.js.map +1 -0
- package/dist/credentials/ups.svg +5 -0
- package/dist/nodes/Ups/Ups.node.d.ts +4 -0
- package/dist/nodes/Ups/Ups.node.js +53 -0
- package/dist/nodes/Ups/Ups.node.js.map +1 -0
- package/dist/nodes/Ups/Ups.node.json +18 -0
- package/dist/nodes/Ups/core/buildCommodities.d.ts +10 -0
- package/dist/nodes/Ups/core/buildCommodities.js +21 -0
- package/dist/nodes/Ups/core/buildCommodities.js.map +1 -0
- package/dist/nodes/Ups/core/buildInternationalForms.d.ts +17 -0
- package/dist/nodes/Ups/core/buildInternationalForms.js +34 -0
- package/dist/nodes/Ups/core/buildInternationalForms.js.map +1 -0
- package/dist/nodes/Ups/core/extractCharges.d.ts +20 -0
- package/dist/nodes/Ups/core/extractCharges.js +13 -0
- package/dist/nodes/Ups/core/extractCharges.js.map +1 -0
- package/dist/nodes/Ups/core/extractForms.d.ts +23 -0
- package/dist/nodes/Ups/core/extractForms.js +25 -0
- package/dist/nodes/Ups/core/extractForms.js.map +1 -0
- package/dist/nodes/Ups/core/extractLabel.d.ts +30 -0
- package/dist/nodes/Ups/core/extractLabel.js +35 -0
- package/dist/nodes/Ups/core/extractLabel.js.map +1 -0
- package/dist/nodes/Ups/core/flattenRates.d.ts +36 -0
- package/dist/nodes/Ups/core/flattenRates.js +58 -0
- package/dist/nodes/Ups/core/flattenRates.js.map +1 -0
- package/dist/nodes/Ups/core/isInternational.d.ts +9 -0
- package/dist/nodes/Ups/core/isInternational.js +15 -0
- package/dist/nodes/Ups/core/isInternational.js.map +1 -0
- package/dist/nodes/Ups/core/mapTrackStatus.d.ts +48 -0
- package/dist/nodes/Ups/core/mapTrackStatus.js +55 -0
- package/dist/nodes/Ups/core/mapTrackStatus.js.map +1 -0
- package/dist/nodes/Ups/core/mapUpsError.d.ts +2 -0
- package/dist/nodes/Ups/core/mapUpsError.js +52 -0
- package/dist/nodes/Ups/core/mapUpsError.js.map +1 -0
- package/dist/nodes/Ups/core/shapeCandidates.d.ts +37 -0
- package/dist/nodes/Ups/core/shapeCandidates.js +68 -0
- package/dist/nodes/Ups/core/shapeCandidates.js.map +1 -0
- package/dist/nodes/Ups/core/toMoney.d.ts +6 -0
- package/dist/nodes/Ups/core/toMoney.js +16 -0
- package/dist/nodes/Ups/core/toMoney.js.map +1 -0
- package/dist/nodes/Ups/core/toUpsAddress.d.ts +12 -0
- package/dist/nodes/Ups/core/toUpsAddress.js +17 -0
- package/dist/nodes/Ups/core/toUpsAddress.js.map +1 -0
- package/dist/nodes/Ups/core/toXavAddress.d.ts +16 -0
- package/dist/nodes/Ups/core/toXavAddress.js +26 -0
- package/dist/nodes/Ups/core/toXavAddress.js.map +1 -0
- package/dist/nodes/Ups/core/types.d.ts +73 -0
- package/dist/nodes/Ups/core/types.js +3 -0
- package/dist/nodes/Ups/core/types.js.map +1 -0
- package/dist/nodes/Ups/resources/address/index.d.ts +2 -0
- package/dist/nodes/Ups/resources/address/index.js +20 -0
- package/dist/nodes/Ups/resources/address/index.js.map +1 -0
- package/dist/nodes/Ups/resources/address/validate.operation.d.ts +24 -0
- package/dist/nodes/Ups/resources/address/validate.operation.js +109 -0
- package/dist/nodes/Ups/resources/address/validate.operation.js.map +1 -0
- package/dist/nodes/Ups/resources/shipping/create.operation.d.ts +24 -0
- package/dist/nodes/Ups/resources/shipping/create.operation.js +363 -0
- package/dist/nodes/Ups/resources/shipping/create.operation.js.map +1 -0
- package/dist/nodes/Ups/resources/shipping/getRates.operation.d.ts +24 -0
- package/dist/nodes/Ups/resources/shipping/getRates.operation.js +126 -0
- package/dist/nodes/Ups/resources/shipping/getRates.operation.js.map +1 -0
- package/dist/nodes/Ups/resources/shipping/index.d.ts +2 -0
- package/dist/nodes/Ups/resources/shipping/index.js +22 -0
- package/dist/nodes/Ups/resources/shipping/index.js.map +1 -0
- package/dist/nodes/Ups/resources/shipping/shared.d.ts +34 -0
- package/dist/nodes/Ups/resources/shipping/shared.js +165 -0
- package/dist/nodes/Ups/resources/shipping/shared.js.map +1 -0
- package/dist/nodes/Ups/resources/tracking/index.d.ts +2 -0
- package/dist/nodes/Ups/resources/tracking/index.js +20 -0
- package/dist/nodes/Ups/resources/tracking/index.js.map +1 -0
- package/dist/nodes/Ups/resources/tracking/track.operation.d.ts +24 -0
- package/dist/nodes/Ups/resources/tracking/track.operation.js +73 -0
- package/dist/nodes/Ups/resources/tracking/track.operation.js.map +1 -0
- package/dist/nodes/Ups/ups.dark.svg +13 -0
- package/dist/nodes/Ups/ups.svg +13 -0
- package/dist/package.json +61 -0
- package/package.json +61 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRatesOperationOption = exports.getRatesOperationDescription = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const toUpsAddress_1 = require("../../core/toUpsAddress");
|
|
6
|
+
const flattenRates_1 = require("../../core/flattenRates");
|
|
7
|
+
const isInternational_1 = require("../../core/isInternational");
|
|
8
|
+
const mapUpsError_1 = require("../../core/mapUpsError");
|
|
9
|
+
const shared_1 = require("./shared");
|
|
10
|
+
const showOnlyForRates = {
|
|
11
|
+
operation: ['getRates'],
|
|
12
|
+
resource: ['shipping'],
|
|
13
|
+
};
|
|
14
|
+
async function ratesPreSend(requestOptions) {
|
|
15
|
+
const node = this.getNode();
|
|
16
|
+
const get = (name, fallback) => this.getNodeParameter(name, fallback);
|
|
17
|
+
const accountNumber = get('accountNumber', '').trim();
|
|
18
|
+
if (!accountNumber) {
|
|
19
|
+
throw new n8n_workflow_1.NodeOperationError(node, 'An account number is required to request rates.', {
|
|
20
|
+
description: 'Enter your UPS account number (ShipperNumber) on the Get Rates operation.',
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const shipper = (0, shared_1.readAddress)(get, 'shipper');
|
|
24
|
+
const shipTo = (0, shared_1.readAddress)(get, 'shipTo');
|
|
25
|
+
const shipFrom = (0, shared_1.readAddress)(get, 'shipFrom');
|
|
26
|
+
const hasShipFrom = shipFrom.addressLines.length > 0 || shipFrom.city.length > 0;
|
|
27
|
+
const effectiveShipFrom = hasShipFrom ? shipFrom : shipper;
|
|
28
|
+
const customsValue = get('customsValue', 0) || 0;
|
|
29
|
+
if ((0, isInternational_1.isInternational)({ shipFrom: effectiveShipFrom, shipper, shipTo }) && customsValue <= 0) {
|
|
30
|
+
throw new n8n_workflow_1.NodeOperationError(node, 'A customs value is required for an international shipment.', {
|
|
31
|
+
description: 'The origin and destination countries differ; enter the customs value of the goods.',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const pkg = (0, shared_1.readPackage)(get);
|
|
35
|
+
const currency = get('customsCurrency', 'USD') || 'USD';
|
|
36
|
+
const weight = get('weight', 1) || 0;
|
|
37
|
+
const weightUnit = get('weightUnit', 'LBS') || 'LBS';
|
|
38
|
+
const shipment = {
|
|
39
|
+
Shipper: { ShipperNumber: accountNumber, Address: (0, toUpsAddress_1.toUpsAddress)(shipper) },
|
|
40
|
+
ShipTo: { Address: (0, toUpsAddress_1.toUpsAddress)(shipTo) },
|
|
41
|
+
ShipFrom: { Address: (0, toUpsAddress_1.toUpsAddress)(effectiveShipFrom) },
|
|
42
|
+
PickupType: { Code: '01' },
|
|
43
|
+
DeliveryTimeInformation: { PackageBillType: '03' },
|
|
44
|
+
ShipmentTotalWeight: {
|
|
45
|
+
UnitOfMeasurement: { Code: weightUnit, Description: weightUnit },
|
|
46
|
+
Weight: String(weight),
|
|
47
|
+
},
|
|
48
|
+
ShipmentRatingOptions: { NegotiatedRatesIndicator: '' },
|
|
49
|
+
Package: { PackagingType: { Code: '02' }, ...pkg },
|
|
50
|
+
};
|
|
51
|
+
if (customsValue > 0) {
|
|
52
|
+
shipment.InvoiceLineTotal = { CurrencyCode: currency, MonetaryValue: String(customsValue) };
|
|
53
|
+
}
|
|
54
|
+
requestOptions.body = {
|
|
55
|
+
RateRequest: {
|
|
56
|
+
Request: { TransactionReference: { CustomerContext: 'n8n-nodes-ups rate' } },
|
|
57
|
+
PickupType: { Code: '01' },
|
|
58
|
+
Shipment: shipment,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
return requestOptions;
|
|
62
|
+
}
|
|
63
|
+
async function ratesPostReceive(_items, response) {
|
|
64
|
+
if (response.statusCode >= 400) {
|
|
65
|
+
(0, mapUpsError_1.mapUpsError)(this.getNode(), response.body, response.statusCode);
|
|
66
|
+
}
|
|
67
|
+
const lines = (0, flattenRates_1.flattenRates)(response.body, { wantTransit: true });
|
|
68
|
+
return lines.map((line) => ({ json: line }));
|
|
69
|
+
}
|
|
70
|
+
exports.getRatesOperationDescription = [
|
|
71
|
+
{
|
|
72
|
+
displayName: 'Account Number',
|
|
73
|
+
name: 'accountNumber',
|
|
74
|
+
type: 'string',
|
|
75
|
+
required: true,
|
|
76
|
+
default: '',
|
|
77
|
+
displayOptions: { show: showOnlyForRates },
|
|
78
|
+
description: 'Your UPS account number (ShipperNumber). Required; also requests negotiated rates.',
|
|
79
|
+
},
|
|
80
|
+
...(0, shared_1.addressFields)({ prefix: 'shipper', label: 'Shipper', show: showOnlyForRates, required: true }),
|
|
81
|
+
...(0, shared_1.addressFields)({
|
|
82
|
+
prefix: 'shipFrom',
|
|
83
|
+
label: 'Ship From (optional, defaults to Shipper)',
|
|
84
|
+
show: showOnlyForRates,
|
|
85
|
+
}),
|
|
86
|
+
...(0, shared_1.addressFields)({
|
|
87
|
+
prefix: 'shipTo',
|
|
88
|
+
label: 'Ship To',
|
|
89
|
+
show: showOnlyForRates,
|
|
90
|
+
required: true,
|
|
91
|
+
includeResidential: true,
|
|
92
|
+
}),
|
|
93
|
+
...(0, shared_1.packageFields)(showOnlyForRates),
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Customs Value',
|
|
96
|
+
name: 'customsValue',
|
|
97
|
+
type: 'number',
|
|
98
|
+
default: 0,
|
|
99
|
+
displayOptions: { show: showOnlyForRates },
|
|
100
|
+
description: 'Declared value of goods. Required when origin and destination countries differ (international).',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
displayName: 'Customs Currency',
|
|
104
|
+
name: 'customsCurrency',
|
|
105
|
+
type: 'string',
|
|
106
|
+
default: 'USD',
|
|
107
|
+
displayOptions: { show: showOnlyForRates },
|
|
108
|
+
description: 'Currency code for the customs value',
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
exports.getRatesOperationOption = {
|
|
112
|
+
name: 'Get Rates',
|
|
113
|
+
value: 'getRates',
|
|
114
|
+
action: 'Get rate quotes',
|
|
115
|
+
description: 'Get service options with published and negotiated rates plus transit times',
|
|
116
|
+
routing: {
|
|
117
|
+
request: {
|
|
118
|
+
method: 'POST',
|
|
119
|
+
url: '/rating/v2409/Shoptimeintransit',
|
|
120
|
+
ignoreHttpStatusErrors: true,
|
|
121
|
+
},
|
|
122
|
+
send: { preSend: [ratesPreSend] },
|
|
123
|
+
output: { postReceive: [ratesPostReceive] },
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=getRates.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRates.operation.js","sourceRoot":"","sources":["../../../../../nodes/Ups/resources/shipping/getRates.operation.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AACtB,0DAAuD;AACvD,0DAAuD;AACvD,gEAA6D;AAC7D,wDAAqD;AACrD,qCAAoG;AAEpG,MAAM,gBAAgB,GAAG;IACxB,SAAS,EAAE,CAAC,UAAU,CAAC;IACvB,QAAQ,EAAE,CAAC,UAAU,CAAC;CACtB,C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AE,gBAAgB;QACtB,QAAQ,EAAE,IAAI;QACd,kBAAkB,EAAE,IAAI;KACxB,CAAC;IACF,GAAG,IAAA,sBAAa,EAAC,gBAAgB,CAAC;IAClC;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC;QACV,cAAc,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;QAC1C,WAAW,EACV,iGAAiG;KAClG;IACD;QACC,WAAW,EAAE,kBAAkB;QAC/B,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,KAAK;QACd,cAAc,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;QAC1C,WAAW,EAAE,qCAAqC;KAClD;CACD,CAAC;AAEW,QAAA,uBAAuB,GAAG;IACtC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,iBAAiB;IACzB,WAAW,EAAE,4EAA4E;IACzF,OAAO,EAAE;QACR,OAAO,EAAE;YACR,MAAM,EAAE,MAAe;YAEvB,GAAG,EAAE,iCAAiC;YACtC,sBAAsB,EAAE,IAAI;SAC5B;QACD,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE;QACjC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,gBAAgB,CAAC,EAAE;KAC3C;CACD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shippingDescription = void 0;
|
|
4
|
+
const getRates_operation_1 = require("./getRates.operation");
|
|
5
|
+
const create_operation_1 = require("./create.operation");
|
|
6
|
+
const showOnlyForShipping = {
|
|
7
|
+
resource: ['shipping'],
|
|
8
|
+
};
|
|
9
|
+
exports.shippingDescription = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Operation',
|
|
12
|
+
name: 'operation',
|
|
13
|
+
type: 'options',
|
|
14
|
+
noDataExpression: true,
|
|
15
|
+
displayOptions: { show: showOnlyForShipping },
|
|
16
|
+
options: [getRates_operation_1.getRatesOperationOption, create_operation_1.createOperationOption],
|
|
17
|
+
default: 'getRates',
|
|
18
|
+
},
|
|
19
|
+
...getRates_operation_1.getRatesOperationDescription,
|
|
20
|
+
...create_operation_1.createOperationDescription,
|
|
21
|
+
];
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Ups/resources/shipping/index.ts"],"names":[],"mappings":";;;AACA,6DAA6F;AAC7F,yDAAuF;AAEvF,MAAM,mBAAmB,GAAG;IAC3B,QAAQ,EAAE,CAAC,UAAU,CAAC;CACtB,CAAC;AAGW,QAAA,mBAAmB,GAAsB;IACrD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;QAC7C,OAAO,EAAE,CAAC,4CAAuB,EAAE,wCAAqB,CAAC;QACzD,OAAO,EAAE,UAAU;KACnB;IACD,GAAG,iDAA4B;IAC/B,GAAG,6CAA0B;CAC7B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IDisplayOptions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import type { NormalizedAddressInput } from '../../core/toXavAddress';
|
|
3
|
+
export type ParamGetter = (name: string, fallback: unknown) => unknown;
|
|
4
|
+
export interface AddressFieldOptions {
|
|
5
|
+
prefix: string;
|
|
6
|
+
label: string;
|
|
7
|
+
show: IDisplayOptions['show'];
|
|
8
|
+
includeName?: boolean;
|
|
9
|
+
includePhone?: boolean;
|
|
10
|
+
includeResidential?: boolean;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function addressFields(opts: AddressFieldOptions): INodeProperties[];
|
|
14
|
+
export declare function readAddress(get: ParamGetter, prefix: string): NormalizedAddressInput & {
|
|
15
|
+
residential?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function packageFields(show: IDisplayOptions['show']): INodeProperties[];
|
|
18
|
+
export interface UpsPackage {
|
|
19
|
+
PackageWeight: {
|
|
20
|
+
UnitOfMeasurement: {
|
|
21
|
+
Code: string;
|
|
22
|
+
};
|
|
23
|
+
Weight: string;
|
|
24
|
+
};
|
|
25
|
+
Dimensions?: {
|
|
26
|
+
UnitOfMeasurement: {
|
|
27
|
+
Code: string;
|
|
28
|
+
};
|
|
29
|
+
Length: string;
|
|
30
|
+
Width: string;
|
|
31
|
+
Height: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare function readPackage(get: ParamGetter): UpsPackage;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addressFields = addressFields;
|
|
4
|
+
exports.readAddress = readAddress;
|
|
5
|
+
exports.packageFields = packageFields;
|
|
6
|
+
exports.readPackage = readPackage;
|
|
7
|
+
function addressFields(opts) {
|
|
8
|
+
var _a;
|
|
9
|
+
const { prefix, label, show } = opts;
|
|
10
|
+
const fields = [];
|
|
11
|
+
if (opts.includeName) {
|
|
12
|
+
fields.push({
|
|
13
|
+
displayName: `${label} Name`,
|
|
14
|
+
name: `${prefix}Name`,
|
|
15
|
+
type: 'string',
|
|
16
|
+
default: '',
|
|
17
|
+
displayOptions: { show },
|
|
18
|
+
description: `${label} contact/company name`,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
fields.push({
|
|
22
|
+
displayName: `${label} Address Line 1`,
|
|
23
|
+
name: `${prefix}AddressLine1`,
|
|
24
|
+
type: 'string',
|
|
25
|
+
default: '',
|
|
26
|
+
required: (_a = opts.required) !== null && _a !== void 0 ? _a : false,
|
|
27
|
+
displayOptions: { show },
|
|
28
|
+
}, {
|
|
29
|
+
displayName: `${label} Address Line 2`,
|
|
30
|
+
name: `${prefix}AddressLine2`,
|
|
31
|
+
type: 'string',
|
|
32
|
+
default: '',
|
|
33
|
+
displayOptions: { show },
|
|
34
|
+
}, {
|
|
35
|
+
displayName: `${label} City`,
|
|
36
|
+
name: `${prefix}City`,
|
|
37
|
+
type: 'string',
|
|
38
|
+
default: '',
|
|
39
|
+
displayOptions: { show },
|
|
40
|
+
}, {
|
|
41
|
+
displayName: `${label} State / Province Code`,
|
|
42
|
+
name: `${prefix}StateProvinceCode`,
|
|
43
|
+
type: 'string',
|
|
44
|
+
default: '',
|
|
45
|
+
displayOptions: { show },
|
|
46
|
+
}, {
|
|
47
|
+
displayName: `${label} Postal Code`,
|
|
48
|
+
name: `${prefix}PostalCode`,
|
|
49
|
+
type: 'string',
|
|
50
|
+
default: '',
|
|
51
|
+
displayOptions: { show },
|
|
52
|
+
}, {
|
|
53
|
+
displayName: `${label} Country Code`,
|
|
54
|
+
name: `${prefix}CountryCode`,
|
|
55
|
+
type: 'string',
|
|
56
|
+
default: 'US',
|
|
57
|
+
displayOptions: { show },
|
|
58
|
+
});
|
|
59
|
+
if (opts.includePhone) {
|
|
60
|
+
fields.push({
|
|
61
|
+
displayName: `${label} Phone`,
|
|
62
|
+
name: `${prefix}Phone`,
|
|
63
|
+
type: 'string',
|
|
64
|
+
default: '',
|
|
65
|
+
displayOptions: { show },
|
|
66
|
+
description: `${label} phone number. UPS may require this for cross-border shipments.`,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (opts.includeResidential) {
|
|
70
|
+
fields.push({
|
|
71
|
+
displayName: `${label} Is Residential`,
|
|
72
|
+
name: `${prefix}Residential`,
|
|
73
|
+
type: 'boolean',
|
|
74
|
+
default: false,
|
|
75
|
+
displayOptions: { show },
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return fields;
|
|
79
|
+
}
|
|
80
|
+
function readAddress(get, prefix) {
|
|
81
|
+
const line1 = get(`${prefix}AddressLine1`, '');
|
|
82
|
+
const line2 = get(`${prefix}AddressLine2`, '');
|
|
83
|
+
return {
|
|
84
|
+
addressLines: [line1, line2].filter((l) => l && l.trim().length > 0),
|
|
85
|
+
city: get(`${prefix}City`, ''),
|
|
86
|
+
stateProvinceCode: get(`${prefix}StateProvinceCode`, ''),
|
|
87
|
+
postalCode: get(`${prefix}PostalCode`, ''),
|
|
88
|
+
countryCode: get(`${prefix}CountryCode`, 'US'),
|
|
89
|
+
residential: get(`${prefix}Residential`, false),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function packageFields(show) {
|
|
93
|
+
return [
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Weight',
|
|
96
|
+
name: 'weight',
|
|
97
|
+
type: 'number',
|
|
98
|
+
default: 1,
|
|
99
|
+
required: true,
|
|
100
|
+
displayOptions: { show },
|
|
101
|
+
description: 'Package weight',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
displayName: 'Weight Unit',
|
|
105
|
+
name: 'weightUnit',
|
|
106
|
+
type: 'options',
|
|
107
|
+
options: [
|
|
108
|
+
{ name: 'Pounds (LBS)', value: 'LBS' },
|
|
109
|
+
{ name: 'Kilograms (KGS)', value: 'KGS' },
|
|
110
|
+
],
|
|
111
|
+
default: 'LBS',
|
|
112
|
+
displayOptions: { show },
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
displayName: 'Dimensions',
|
|
116
|
+
name: 'dimensions',
|
|
117
|
+
type: 'fixedCollection',
|
|
118
|
+
default: {},
|
|
119
|
+
displayOptions: { show },
|
|
120
|
+
description: 'Optional package dimensions',
|
|
121
|
+
options: [
|
|
122
|
+
{
|
|
123
|
+
displayName: 'Dimension',
|
|
124
|
+
name: 'dimension',
|
|
125
|
+
values: [
|
|
126
|
+
{ displayName: 'Length', name: 'length', type: 'number', default: 0 },
|
|
127
|
+
{ displayName: 'Width', name: 'width', type: 'number', default: 0 },
|
|
128
|
+
{ displayName: 'Height', name: 'height', type: 'number', default: 0 },
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Dimension Unit',
|
|
135
|
+
name: 'dimensionUnit',
|
|
136
|
+
type: 'options',
|
|
137
|
+
options: [
|
|
138
|
+
{ name: 'Inches (IN)', value: 'IN' },
|
|
139
|
+
{ name: 'Centimeters (CM)', value: 'CM' },
|
|
140
|
+
],
|
|
141
|
+
default: 'IN',
|
|
142
|
+
displayOptions: { show },
|
|
143
|
+
},
|
|
144
|
+
];
|
|
145
|
+
}
|
|
146
|
+
function readPackage(get) {
|
|
147
|
+
var _a, _b, _c;
|
|
148
|
+
const weight = get('weight', 1);
|
|
149
|
+
const weightUnit = get('weightUnit', 'LBS');
|
|
150
|
+
const pkg = {
|
|
151
|
+
PackageWeight: { UnitOfMeasurement: { Code: weightUnit }, Weight: String(weight) },
|
|
152
|
+
};
|
|
153
|
+
const dims = get('dimensions.dimension', {});
|
|
154
|
+
if (dims.length || dims.width || dims.height) {
|
|
155
|
+
const dimUnit = get('dimensionUnit', 'IN');
|
|
156
|
+
pkg.Dimensions = {
|
|
157
|
+
UnitOfMeasurement: { Code: dimUnit },
|
|
158
|
+
Length: String((_a = dims.length) !== null && _a !== void 0 ? _a : 0),
|
|
159
|
+
Width: String((_b = dims.width) !== null && _b !== void 0 ? _b : 0),
|
|
160
|
+
Height: String((_c = dims.height) !== null && _c !== void 0 ? _c : 0),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
return pkg;
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../nodes/Ups/resources/shipping/shared.ts"],"names":[],"mappings":";;AAqBA,sCAmFC;AAED,kCAcC;AAGD,sCAqDC;AAYD,kCA2BC;AAlMD,SAAgB,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EAAE;YACpC,MAAM,EAAE,MAAM,CAAC,MAAA,IAAI,CAAC,MAAM,mCAAI,CAAC,CAAC;YAChC,KAAK,EAAE,MAAM,CAAC,MAAA,IAAI,CAAC,KAAK,mCAAI,CAAC,CAAC;YAC9B,MAAM,EAAE,MAAM,CAAC,MAAA,IAAI,CAAC,MAAM,mCAAI,CAAC,CAAC;SAChC,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackingDescription = void 0;
|
|
4
|
+
const track_operation_1 = require("./track.operation");
|
|
5
|
+
const showOnlyForTracking = {
|
|
6
|
+
resource: ['tracking'],
|
|
7
|
+
};
|
|
8
|
+
exports.trackingDescription = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'Operation',
|
|
11
|
+
name: 'operation',
|
|
12
|
+
type: 'options',
|
|
13
|
+
noDataExpression: true,
|
|
14
|
+
displayOptions: { show: showOnlyForTracking },
|
|
15
|
+
options: [track_operation_1.trackOperationOption],
|
|
16
|
+
default: 'track',
|
|
17
|
+
},
|
|
18
|
+
...track_operation_1.trackOperationDescription,
|
|
19
|
+
];
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Ups/resources/tracking/index.ts"],"names":[],"mappings":";;;AACA,uDAAoF;AAEpF,MAAM,mBAAmB,GAAG;IAC3B,QAAQ,EAAE,CAAC,UAAU,CAAC;CACtB,CAAC;AAGW,QAAA,mBAAmB,GAAsB;IACrD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;QAC7C,OAAO,EAAE,CAAC,sCAAoB,CAAC;QAC/B,OAAO,EAAE,OAAO;KAChB;IACD,GAAG,2CAAyB;CAC5B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IExecuteSingleFunctions, IN8nHttpFullResponse, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
declare function trackPostReceive(this: IExecuteSingleFunctions, _items: INodeExecutionData[], response: IN8nHttpFullResponse): Promise<INodeExecutionData[]>;
|
|
3
|
+
export declare const trackOperationDescription: INodeProperties[];
|
|
4
|
+
export declare const trackOperationOption: {
|
|
5
|
+
name: string;
|
|
6
|
+
value: string;
|
|
7
|
+
action: string;
|
|
8
|
+
description: string;
|
|
9
|
+
routing: {
|
|
10
|
+
request: {
|
|
11
|
+
method: "GET";
|
|
12
|
+
url: string;
|
|
13
|
+
headers: {
|
|
14
|
+
transId: string;
|
|
15
|
+
transactionSrc: string;
|
|
16
|
+
};
|
|
17
|
+
ignoreHttpStatusErrors: boolean;
|
|
18
|
+
};
|
|
19
|
+
output: {
|
|
20
|
+
postReceive: (typeof trackPostReceive)[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackOperationOption = exports.trackOperationDescription = void 0;
|
|
4
|
+
const mapTrackStatus_1 = require("../../core/mapTrackStatus");
|
|
5
|
+
const mapUpsError_1 = require("../../core/mapUpsError");
|
|
6
|
+
const showOnlyForTrack = {
|
|
7
|
+
operation: ['track'],
|
|
8
|
+
resource: ['tracking'],
|
|
9
|
+
};
|
|
10
|
+
async function trackPostReceive(_items, response) {
|
|
11
|
+
if (response.statusCode >= 400) {
|
|
12
|
+
(0, mapUpsError_1.mapUpsError)(this.getNode(), response.body, response.statusCode);
|
|
13
|
+
}
|
|
14
|
+
const detail = this.getNodeParameter('detail', 'detailed');
|
|
15
|
+
const results = (0, mapTrackStatus_1.mapTrackStatus)(response.body, { detail });
|
|
16
|
+
return results.map((json) => ({ json: json }));
|
|
17
|
+
}
|
|
18
|
+
exports.trackOperationDescription = [
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Tracking Number',
|
|
21
|
+
name: 'trackingNumber',
|
|
22
|
+
type: 'string',
|
|
23
|
+
required: true,
|
|
24
|
+
default: '',
|
|
25
|
+
placeholder: '1Z9999999999999999',
|
|
26
|
+
displayOptions: { show: showOnlyForTrack },
|
|
27
|
+
description: 'The UPS inquiry (tracking) number to look up. One number per item.',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
displayName: 'Detail',
|
|
31
|
+
name: 'detail',
|
|
32
|
+
type: 'options',
|
|
33
|
+
options: [
|
|
34
|
+
{ name: 'Detailed (Status + Activity History)', value: 'detailed' },
|
|
35
|
+
{ name: 'Status Only', value: 'status' },
|
|
36
|
+
],
|
|
37
|
+
default: 'detailed',
|
|
38
|
+
displayOptions: { show: showOnlyForTrack },
|
|
39
|
+
description: 'Whether to include the full scan/activity history or only the current status',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Locale',
|
|
43
|
+
name: 'locale',
|
|
44
|
+
type: 'string',
|
|
45
|
+
default: 'en_US',
|
|
46
|
+
displayOptions: { show: showOnlyForTrack },
|
|
47
|
+
description: 'Language and country code for status text, separated by an underscore (e.g. en_US)',
|
|
48
|
+
routing: {
|
|
49
|
+
send: { type: 'query', property: 'locale' },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
exports.trackOperationOption = {
|
|
54
|
+
name: 'Track',
|
|
55
|
+
value: 'track',
|
|
56
|
+
action: 'Track a shipment',
|
|
57
|
+
description: 'Get current status and scan history for a tracking number',
|
|
58
|
+
routing: {
|
|
59
|
+
request: {
|
|
60
|
+
method: 'GET',
|
|
61
|
+
url: '=/track/v1/details/{{$parameter.trackingNumber}}',
|
|
62
|
+
headers: {
|
|
63
|
+
transId: "={{ 'n8n-' + $now.toMillis() }}",
|
|
64
|
+
transactionSrc: 'n8n-nodes-ups',
|
|
65
|
+
},
|
|
66
|
+
ignoreHttpStatusErrors: true,
|
|
67
|
+
},
|
|
68
|
+
output: {
|
|
69
|
+
postReceive: [trackPostReceive],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=track.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track.operation.js","sourceRoot":"","sources":["../../../../../nodes/Ups/resources/tracking/track.operation.ts"],"names":[],"mappings":";;;AAMA,8DAA6E;AAC7E,wDAAqD;AAErD,MAAM,gBAAgB,GAAG;IACxB,SAAS,EAAE,CAAC,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,UAAU,CAAC;CACtB,CAAC;AAKF,KAAK,UAAU,gBAAgB,CAE9B,MAA4B,EAC5B,QAA8B;IAE9B,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE,CAAC;QAChC,IAAA,yBAAW,EAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAgB,CAAC;IAC1E,MAAM,OAAO,GAAG,IAAA,+BAAc,EAAC,QAAQ,CAAC,IAAc,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACpE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAA6C,EAAE,CAAC,CAAC,CAAC;AACzF,CAAC;AAIY,QAAA,yBAAyB,GAAsB;IAC3D;QACC,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OA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fill="none" stroke="aquamarine"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
|
3
|
+
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
|
4
|
+
<rect x="9" y="9" width="6" height="6"></rect>
|
|
5
|
+
<line x1="9" y1="1" x2="9" y2="4"></line>
|
|
6
|
+
<line x1="15" y1="1" x2="15" y2="4"></line>
|
|
7
|
+
<line x1="9" y1="20" x2="9" y2="23"></line>
|
|
8
|
+
<line x1="15" y1="20" x2="15" y2="23"></line>
|
|
9
|
+
<line x1="20" y1="9" x2="23" y2="9"></line>
|
|
10
|
+
<line x1="20" y1="14" x2="23" y2="14"></line>
|
|
11
|
+
<line x1="1" y1="9" x2="4" y2="9"></line>
|
|
12
|
+
<line x1="1" y1="14" x2="4" y2="14"></line>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="darkblue"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
|
3
|
+
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
|
4
|
+
<rect x="9" y="9" width="6" height="6"></rect>
|
|
5
|
+
<line x1="9" y1="1" x2="9" y2="4"></line>
|
|
6
|
+
<line x1="15" y1="1" x2="15" y2="4"></line>
|
|
7
|
+
<line x1="9" y1="20" x2="9" y2="23"></line>
|
|
8
|
+
<line x1="15" y1="20" x2="15" y2="23"></line>
|
|
9
|
+
<line x1="20" y1="9" x2="23" y2="9"></line>
|
|
10
|
+
<line x1="20" y1="14" x2="23" y2="14"></line>
|
|
11
|
+
<line x1="1" y1="9" x2="4" y2="9"></line>
|
|
12
|
+
<line x1="1" y1="14" x2="4" y2="14"></line>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-ups",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "n8n community node for UPS: rating, tracking, and address validation via the UPS REST API.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/nodrel-dev/n8n-nodes-ups",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"n8n-community-node-package"
|
|
9
|
+
],
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "nodrel-dev",
|
|
12
|
+
"email": "289239657+nodrel-dev@users.noreply.github.com"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/nodrel-dev/n8n-nodes-ups.git"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "n8n-node build",
|
|
20
|
+
"build:watch": "tsc --watch",
|
|
21
|
+
"dev": "n8n-node dev",
|
|
22
|
+
"lint": "n8n-node lint",
|
|
23
|
+
"lint:fix": "n8n-node lint --fix",
|
|
24
|
+
"release": "n8n-node release",
|
|
25
|
+
"prepublishOnly": "n8n-node prerelease",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public",
|
|
34
|
+
"provenance": true
|
|
35
|
+
},
|
|
36
|
+
"n8n": {
|
|
37
|
+
"n8nNodesApiVersion": 1,
|
|
38
|
+
"strict": true,
|
|
39
|
+
"credentials": [
|
|
40
|
+
"dist/credentials/UpsOAuth2Api.credentials.js"
|
|
41
|
+
],
|
|
42
|
+
"nodes": [
|
|
43
|
+
"dist/nodes/Ups/Ups.node.js"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@commitlint/cli": "^21.0.2",
|
|
48
|
+
"@commitlint/config-conventional": "^21.0.2",
|
|
49
|
+
"@n8n/node-cli": "*",
|
|
50
|
+
"@types/node": "^22.19.21",
|
|
51
|
+
"eslint": "9.32.0",
|
|
52
|
+
"lefthook": "^2.1.9",
|
|
53
|
+
"n8n-workflow": "^2.16.0",
|
|
54
|
+
"prettier": "3.6.2",
|
|
55
|
+
"typescript": "5.9.2",
|
|
56
|
+
"vitest": "^3.2.4"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"n8n-workflow": "*"
|
|
60
|
+
}
|
|
61
|
+
}
|