@nodrel-dev/n8n-nodes-fedex 0.1.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 +113 -0
- package/dist/credentials/FedexOAuth2Api.credentials.d.ts +9 -0
- package/dist/credentials/FedexOAuth2Api.credentials.js +57 -0
- package/dist/credentials/FedexOAuth2Api.credentials.js.map +1 -0
- package/dist/credentials/fedex.dark.svg +5 -0
- package/dist/credentials/fedex.svg +5 -0
- package/dist/nodes/Fedex/Fedex.node.d.ts +4 -0
- package/dist/nodes/Fedex/Fedex.node.js +50 -0
- package/dist/nodes/Fedex/Fedex.node.js.map +1 -0
- package/dist/nodes/Fedex/Fedex.node.json +18 -0
- package/dist/nodes/Fedex/constants.d.ts +8 -0
- package/dist/nodes/Fedex/constants.js +50 -0
- package/dist/nodes/Fedex/constants.js.map +1 -0
- package/dist/nodes/Fedex/cores/extractLabel.d.ts +15 -0
- package/dist/nodes/Fedex/cores/extractLabel.js +49 -0
- package/dist/nodes/Fedex/cores/extractLabel.js.map +1 -0
- package/dist/nodes/Fedex/cores/fedexTypes.d.ts +27 -0
- package/dist/nodes/Fedex/cores/fedexTypes.js +3 -0
- package/dist/nodes/Fedex/cores/fedexTypes.js.map +1 -0
- package/dist/nodes/Fedex/cores/shapeRates.d.ts +8 -0
- package/dist/nodes/Fedex/cores/shapeRates.js +24 -0
- package/dist/nodes/Fedex/cores/shapeRates.js.map +1 -0
- package/dist/nodes/Fedex/cores/toFedexAddress.d.ts +10 -0
- package/dist/nodes/Fedex/cores/toFedexAddress.js +24 -0
- package/dist/nodes/Fedex/cores/toFedexAddress.js.map +1 -0
- package/dist/nodes/Fedex/cores/toFedexContact.d.ts +8 -0
- package/dist/nodes/Fedex/cores/toFedexContact.js +16 -0
- package/dist/nodes/Fedex/cores/toFedexContact.js.map +1 -0
- package/dist/nodes/Fedex/fedex.dark.svg +5 -0
- package/dist/nodes/Fedex/fedex.svg +5 -0
- package/dist/nodes/Fedex/fields.d.ts +16 -0
- package/dist/nodes/Fedex/fields.js +201 -0
- package/dist/nodes/Fedex/fields.js.map +1 -0
- package/dist/nodes/Fedex/resources/address/index.d.ts +2 -0
- package/dist/nodes/Fedex/resources/address/index.js +30 -0
- package/dist/nodes/Fedex/resources/address/index.js.map +1 -0
- package/dist/nodes/Fedex/resources/address/validate.d.ts +3 -0
- package/dist/nodes/Fedex/resources/address/validate.js +48 -0
- package/dist/nodes/Fedex/resources/address/validate.js.map +1 -0
- package/dist/nodes/Fedex/resources/shared.d.ts +12 -0
- package/dist/nodes/Fedex/resources/shared.js +69 -0
- package/dist/nodes/Fedex/resources/shared.js.map +1 -0
- package/dist/nodes/Fedex/resources/shipment/create.d.ts +4 -0
- package/dist/nodes/Fedex/resources/shipment/create.js +86 -0
- package/dist/nodes/Fedex/resources/shipment/create.js.map +1 -0
- package/dist/nodes/Fedex/resources/shipment/getRates.d.ts +4 -0
- package/dist/nodes/Fedex/resources/shipment/getRates.js +38 -0
- package/dist/nodes/Fedex/resources/shipment/getRates.js.map +1 -0
- package/dist/nodes/Fedex/resources/shipment/index.d.ts +2 -0
- package/dist/nodes/Fedex/resources/shipment/index.js +56 -0
- package/dist/nodes/Fedex/resources/shipment/index.js.map +1 -0
- package/dist/nodes/Fedex/resources/shipment/track.d.ts +3 -0
- package/dist/nodes/Fedex/resources/shipment/track.js +61 -0
- package/dist/nodes/Fedex/resources/shipment/track.js.map +1 -0
- package/dist/package.json +42 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accountNumberField = accountNumberField;
|
|
4
|
+
exports.addressFields = addressFields;
|
|
5
|
+
exports.contactFields = contactFields;
|
|
6
|
+
exports.pickupTypeField = pickupTypeField;
|
|
7
|
+
exports.serviceTypeField = serviceTypeField;
|
|
8
|
+
exports.packagingTypeField = packagingTypeField;
|
|
9
|
+
exports.packageFields = packageFields;
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const label = (role) => (role === 'shipper' ? 'Shipper' : 'Recipient');
|
|
12
|
+
const cap = (role) => label(role);
|
|
13
|
+
function accountNumberField(show) {
|
|
14
|
+
return {
|
|
15
|
+
displayName: 'Shipping Account Number',
|
|
16
|
+
name: 'shippingAccountNumber',
|
|
17
|
+
type: 'string',
|
|
18
|
+
default: '',
|
|
19
|
+
required: true,
|
|
20
|
+
displayOptions: { show },
|
|
21
|
+
description: 'Your FedEx account number — determines whose negotiated rates apply and who is billed',
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function addressFields(role, show, opts = {}) {
|
|
25
|
+
const fields = [
|
|
26
|
+
{
|
|
27
|
+
displayName: `${cap(role)} Street Lines`,
|
|
28
|
+
name: `${role}StreetLines`,
|
|
29
|
+
type: 'string',
|
|
30
|
+
typeOptions: { rows: 2 },
|
|
31
|
+
default: '',
|
|
32
|
+
displayOptions: { show },
|
|
33
|
+
description: 'Street address. Put each additional line (suite, apt) on its own line; up to three are sent.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: `${cap(role)} City`,
|
|
37
|
+
name: `${role}City`,
|
|
38
|
+
type: 'string',
|
|
39
|
+
default: '',
|
|
40
|
+
displayOptions: { show },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
displayName: `${cap(role)} State/Province Code`,
|
|
44
|
+
name: `${role}StateOrProvinceCode`,
|
|
45
|
+
type: 'string',
|
|
46
|
+
default: '',
|
|
47
|
+
placeholder: 'TN',
|
|
48
|
+
displayOptions: { show },
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
displayName: `${cap(role)} Postal Code`,
|
|
52
|
+
name: `${role}PostalCode`,
|
|
53
|
+
type: 'string',
|
|
54
|
+
default: '',
|
|
55
|
+
displayOptions: { show },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
displayName: `${cap(role)} Country Code`,
|
|
59
|
+
name: `${role}CountryCode`,
|
|
60
|
+
type: 'string',
|
|
61
|
+
default: 'US',
|
|
62
|
+
description: 'Two-letter ISO country code',
|
|
63
|
+
displayOptions: { show },
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
if (opts.residential) {
|
|
67
|
+
fields.push({
|
|
68
|
+
displayName: 'Recipient Is Residential',
|
|
69
|
+
name: `${role}Residential`,
|
|
70
|
+
type: 'boolean',
|
|
71
|
+
default: false,
|
|
72
|
+
displayOptions: { show },
|
|
73
|
+
description: 'Whether the recipient address is residential (affects service availability and rating)',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return fields;
|
|
77
|
+
}
|
|
78
|
+
function contactFields(role, show) {
|
|
79
|
+
return [
|
|
80
|
+
{
|
|
81
|
+
displayName: `${cap(role)} Contact Name`,
|
|
82
|
+
name: `${role}PersonName`,
|
|
83
|
+
type: 'string',
|
|
84
|
+
default: '',
|
|
85
|
+
displayOptions: { show },
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
displayName: `${cap(role)} Company Name`,
|
|
89
|
+
name: `${role}CompanyName`,
|
|
90
|
+
type: 'string',
|
|
91
|
+
default: '',
|
|
92
|
+
displayOptions: { show },
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: `${cap(role)} Phone Number`,
|
|
96
|
+
name: `${role}PhoneNumber`,
|
|
97
|
+
type: 'string',
|
|
98
|
+
default: '',
|
|
99
|
+
required: true,
|
|
100
|
+
displayOptions: { show },
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
displayName: `${cap(role)} Email`,
|
|
104
|
+
name: `${role}EmailAddress`,
|
|
105
|
+
type: 'string',
|
|
106
|
+
default: '',
|
|
107
|
+
displayOptions: { show },
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
function pickupTypeField(show) {
|
|
112
|
+
return {
|
|
113
|
+
displayName: 'Pickup Type',
|
|
114
|
+
name: 'pickupType',
|
|
115
|
+
type: 'options',
|
|
116
|
+
options: constants_1.PICKUP_TYPE_OPTIONS,
|
|
117
|
+
default: 'USE_SCHEDULED_PICKUP',
|
|
118
|
+
displayOptions: { show },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function serviceTypeField(show, required) {
|
|
122
|
+
return {
|
|
123
|
+
displayName: 'Service Type',
|
|
124
|
+
name: 'serviceType',
|
|
125
|
+
type: 'options',
|
|
126
|
+
options: required
|
|
127
|
+
? constants_1.SERVICE_TYPE_OPTIONS
|
|
128
|
+
: [{ name: 'All Available Services', value: '' }, ...constants_1.SERVICE_TYPE_OPTIONS],
|
|
129
|
+
default: '',
|
|
130
|
+
required,
|
|
131
|
+
displayOptions: { show },
|
|
132
|
+
description: required
|
|
133
|
+
? 'FedEx service to ship with'
|
|
134
|
+
: 'Restrict the quote to one service, or leave as all',
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function packagingTypeField(show) {
|
|
138
|
+
return {
|
|
139
|
+
displayName: 'Packaging Type',
|
|
140
|
+
name: 'packagingType',
|
|
141
|
+
type: 'options',
|
|
142
|
+
options: constants_1.PACKAGING_TYPE_OPTIONS,
|
|
143
|
+
default: 'YOUR_PACKAGING',
|
|
144
|
+
displayOptions: { show },
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function packageFields(show) {
|
|
148
|
+
return [
|
|
149
|
+
{
|
|
150
|
+
displayName: 'Package Weight',
|
|
151
|
+
name: 'packageWeight',
|
|
152
|
+
type: 'number',
|
|
153
|
+
default: 1,
|
|
154
|
+
required: true,
|
|
155
|
+
typeOptions: { minValue: 0 },
|
|
156
|
+
displayOptions: { show },
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
displayName: 'Weight Unit',
|
|
160
|
+
name: 'weightUnit',
|
|
161
|
+
type: 'options',
|
|
162
|
+
options: constants_1.WEIGHT_UNIT_OPTIONS,
|
|
163
|
+
default: 'LB',
|
|
164
|
+
displayOptions: { show },
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
displayName: 'Length',
|
|
168
|
+
name: 'packageLength',
|
|
169
|
+
type: 'number',
|
|
170
|
+
default: 0,
|
|
171
|
+
typeOptions: { minValue: 0 },
|
|
172
|
+
displayOptions: { show },
|
|
173
|
+
description: 'Optional. Dimensions are sent only when length, width, and height are all greater than zero.',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
displayName: 'Width',
|
|
177
|
+
name: 'packageWidth',
|
|
178
|
+
type: 'number',
|
|
179
|
+
default: 0,
|
|
180
|
+
typeOptions: { minValue: 0 },
|
|
181
|
+
displayOptions: { show },
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
displayName: 'Height',
|
|
185
|
+
name: 'packageHeight',
|
|
186
|
+
type: 'number',
|
|
187
|
+
default: 0,
|
|
188
|
+
typeOptions: { minValue: 0 },
|
|
189
|
+
displayOptions: { show },
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
displayName: 'Dimension Unit',
|
|
193
|
+
name: 'dimensionUnit',
|
|
194
|
+
type: 'options',
|
|
195
|
+
options: constants_1.DIMENSION_UNIT_OPTIONS,
|
|
196
|
+
default: 'IN',
|
|
197
|
+
displayOptions: { show },
|
|
198
|
+
},
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../nodes/Fedex/fields.ts"],"names":[],"mappings":";;AAmBA,gDAWC;AAED,sCA6DC;AAED,sCAgCC;AAED,0CASC;AAED,4CAeC;AAED,gDASC;AAED,sCAsDC;AA7ND,2CAMqB;AASrB,MAAM,KAAK,GAAG,CAAC,IAAU,EAAU,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;AACrF,MAAM,GAAG,GA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IAAI;YACd,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;YAC5B,cAAc,EAAE,EAAE,IAAI,EAAE;SACxB;QACD;YACC,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,+BAAmB;YAC5B,OAAO,EAAE,IAAI;YACb,cAAc,EAAE,EAAE,IAAI,EAAE;SACxB;QACD;YACC,WAAW,EAAE,QAAQ;YACrB,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;YAC5B,cAAc,EAAE,EAAE,IAAI,EAAE;YACxB,WAAW,EACV,8FAA8F;SAC/F;QACD;YACC,WAAW,EAAE,OAAO;YACpB,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;YAC5B,cAAc,EAAE,EAAE,IAAI,EAAE;SACxB;QACD;YACC,WAAW,EAAE,QAAQ;YACrB,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;YAC5B,cAAc,EAAE,EAAE,IAAI,EAAE;SACxB;QACD;YACC,WAAW,EAAE,gBAAgB;YAC7B,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,kCAAsB;YAC/B,OAAO,EAAE,IAAI;YACb,cAAc,EAAE,EAAE,IAAI,EAAE;SACxB;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addressDescription = void 0;
|
|
4
|
+
const validate_1 = require("./validate");
|
|
5
|
+
const showForAddress = { resource: ['address'] };
|
|
6
|
+
exports.addressDescription = [
|
|
7
|
+
{
|
|
8
|
+
displayName: 'Operation',
|
|
9
|
+
name: 'operation',
|
|
10
|
+
type: 'options',
|
|
11
|
+
noDataExpression: true,
|
|
12
|
+
displayOptions: { show: showForAddress },
|
|
13
|
+
options: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Validate',
|
|
16
|
+
value: 'validate',
|
|
17
|
+
action: 'Validate an address',
|
|
18
|
+
description: 'Standardize an address and classify it residential vs commercial',
|
|
19
|
+
routing: {
|
|
20
|
+
request: { method: 'POST', url: '/address/v1/addresses/resolve' },
|
|
21
|
+
send: { preSend: [validate_1.validatePreSend] },
|
|
22
|
+
output: { postReceive: [{ type: 'rootProperty', properties: { property: 'output.resolvedAddresses' } }] },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
default: 'validate',
|
|
27
|
+
},
|
|
28
|
+
...validate_1.validateFields,
|
|
29
|
+
];
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Fedex/resources/address/index.ts"],"names":[],"mappings":";;;AACA,yCAA6D;AAE7D,MAAM,cAAc,GAAG,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;AAEpC,QAAA,kBAAkB,GAAsB;IACpD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;QACxC,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,qBAAqB;gBAC7B,WAAW,EAAE,kEAAkE;gBAC/E,OAAO,EAAE;oBACR,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,+BAA+B,EAAE;oBACjE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,0BAAe,CAAC,EAAE;oBACpC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,0BAA0B,EAAE,EAAE,CAAC,EAAE;iBACzG;aACD;SACD;QACD,OAAO,EAAE,UAAU;KACnB;IACD,GAAG,yBAAc;CACjB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IExecuteSingleFunctions, IHttpRequestOptions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const validateFields: INodeProperties[];
|
|
3
|
+
export declare function validatePreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateFields = void 0;
|
|
4
|
+
exports.validatePreSend = validatePreSend;
|
|
5
|
+
const toFedexAddress_1 = require("../../cores/toFedexAddress");
|
|
6
|
+
const show = { resource: ['address'], operation: ['validate'] };
|
|
7
|
+
exports.validateFields = [
|
|
8
|
+
{
|
|
9
|
+
displayName: 'Street Lines',
|
|
10
|
+
name: 'addressStreetLines',
|
|
11
|
+
type: 'string',
|
|
12
|
+
typeOptions: { rows: 2 },
|
|
13
|
+
default: '',
|
|
14
|
+
displayOptions: { show },
|
|
15
|
+
description: 'Street address. Put each additional line on its own line; up to three are sent.',
|
|
16
|
+
},
|
|
17
|
+
{ displayName: 'City', name: 'addressCity', type: 'string', default: '', displayOptions: { show } },
|
|
18
|
+
{
|
|
19
|
+
displayName: 'State/Province Code',
|
|
20
|
+
name: 'addressStateOrProvinceCode',
|
|
21
|
+
type: 'string',
|
|
22
|
+
default: '',
|
|
23
|
+
placeholder: 'TN',
|
|
24
|
+
displayOptions: { show },
|
|
25
|
+
},
|
|
26
|
+
{ displayName: 'Postal Code', name: 'addressPostalCode', type: 'string', default: '', displayOptions: { show } },
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Country Code',
|
|
29
|
+
name: 'addressCountryCode',
|
|
30
|
+
type: 'string',
|
|
31
|
+
default: 'US',
|
|
32
|
+
description: 'Two-letter ISO country code',
|
|
33
|
+
displayOptions: { show },
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
async function validatePreSend(requestOptions) {
|
|
37
|
+
var _a, _b, _c, _d, _e;
|
|
38
|
+
const address = (0, toFedexAddress_1.toFedexAddress)({
|
|
39
|
+
streetLines: String((_a = this.getNodeParameter('addressStreetLines', '')) !== null && _a !== void 0 ? _a : ''),
|
|
40
|
+
city: String((_b = this.getNodeParameter('addressCity', '')) !== null && _b !== void 0 ? _b : ''),
|
|
41
|
+
stateOrProvinceCode: String((_c = this.getNodeParameter('addressStateOrProvinceCode', '')) !== null && _c !== void 0 ? _c : ''),
|
|
42
|
+
postalCode: String((_d = this.getNodeParameter('addressPostalCode', '')) !== null && _d !== void 0 ? _d : ''),
|
|
43
|
+
countryCode: String((_e = this.getNodeParameter('addressCountryCode', 'US')) !== null && _e !== void 0 ? _e : 'US'),
|
|
44
|
+
});
|
|
45
|
+
const body = { addressesToValidate: [{ address }] };
|
|
46
|
+
return { ...requestOptions, body };
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../nodes/Fedex/resources/address/validate.ts"],"names":[],"mappings":";;;AAqCA,0CAcC;AAlDD,+DAA4D;AAE5D,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;AAInD,QAAA,cAAc,GAAsB;IAChD;QACC,WAAW,EAAE,cAAc;QAC3B,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,QAAQ;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AAA,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,EAAE,CAAC,mCAAI,EAAE,CAAC;QACxE,WAAW,EAAE,MAAM,CAAC,MAAA,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,IAAI,CAAC,mCAAI,IAAI,CAAC;KAC9E,CAAC,CAAC;IAEH,MAAM,IAAI,GAAgB,EAAE,mBAAmB,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACjE,OAAO,EAAE,GAAG,cAAc,EAAE,IAAI,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteSingleFunctions } from 'n8n-workflow';
|
|
2
|
+
import type { AddressInput } from '../cores/toFedexAddress';
|
|
3
|
+
import type { ContactInput } from '../cores/toFedexContact';
|
|
4
|
+
export declare function readString(ctx: IExecuteSingleFunctions, name: string, fallback?: string): string;
|
|
5
|
+
export declare function readNumber(ctx: IExecuteSingleFunctions, name: string, fallback?: number): number;
|
|
6
|
+
export declare function readBoolean(ctx: IExecuteSingleFunctions, name: string, fallback?: boolean): boolean;
|
|
7
|
+
export declare function readAddressInput(ctx: IExecuteSingleFunctions, role: 'shipper' | 'recipient', opts?: {
|
|
8
|
+
residential?: boolean;
|
|
9
|
+
}): AddressInput;
|
|
10
|
+
export declare function readContactInput(ctx: IExecuteSingleFunctions, role: 'shipper' | 'recipient'): ContactInput;
|
|
11
|
+
export declare function readPackageLineItem(ctx: IExecuteSingleFunctions): IDataObject;
|
|
12
|
+
export declare function requireAccountNumber(ctx: IExecuteSingleFunctions): string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readString = readString;
|
|
4
|
+
exports.readNumber = readNumber;
|
|
5
|
+
exports.readBoolean = readBoolean;
|
|
6
|
+
exports.readAddressInput = readAddressInput;
|
|
7
|
+
exports.readContactInput = readContactInput;
|
|
8
|
+
exports.readPackageLineItem = readPackageLineItem;
|
|
9
|
+
exports.requireAccountNumber = requireAccountNumber;
|
|
10
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
11
|
+
function readString(ctx, name, fallback = '') {
|
|
12
|
+
var _a;
|
|
13
|
+
return String((_a = ctx.getNodeParameter(name, fallback)) !== null && _a !== void 0 ? _a : '').trim();
|
|
14
|
+
}
|
|
15
|
+
function readNumber(ctx, name, fallback = 0) {
|
|
16
|
+
var _a;
|
|
17
|
+
return Number((_a = ctx.getNodeParameter(name, fallback)) !== null && _a !== void 0 ? _a : 0);
|
|
18
|
+
}
|
|
19
|
+
function readBoolean(ctx, name, fallback = false) {
|
|
20
|
+
return Boolean(ctx.getNodeParameter(name, fallback));
|
|
21
|
+
}
|
|
22
|
+
function readAddressInput(ctx, role, opts = {}) {
|
|
23
|
+
return {
|
|
24
|
+
streetLines: readString(ctx, `${role}StreetLines`),
|
|
25
|
+
city: readString(ctx, `${role}City`),
|
|
26
|
+
stateOrProvinceCode: readString(ctx, `${role}StateOrProvinceCode`),
|
|
27
|
+
postalCode: readString(ctx, `${role}PostalCode`),
|
|
28
|
+
countryCode: readString(ctx, `${role}CountryCode`, 'US'),
|
|
29
|
+
...(opts.residential ? { residential: readBoolean(ctx, `${role}Residential`) } : {}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function readContactInput(ctx, role) {
|
|
33
|
+
return {
|
|
34
|
+
personName: readString(ctx, `${role}PersonName`),
|
|
35
|
+
companyName: readString(ctx, `${role}CompanyName`),
|
|
36
|
+
phoneNumber: readString(ctx, `${role}PhoneNumber`),
|
|
37
|
+
emailAddress: readString(ctx, `${role}EmailAddress`),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function readPackageLineItem(ctx) {
|
|
41
|
+
const weight = {
|
|
42
|
+
units: readString(ctx, 'weightUnit', 'LB') === 'KG' ? 'KG' : 'LB',
|
|
43
|
+
value: readNumber(ctx, 'packageWeight'),
|
|
44
|
+
};
|
|
45
|
+
const length = readNumber(ctx, 'packageLength');
|
|
46
|
+
const width = readNumber(ctx, 'packageWidth');
|
|
47
|
+
const height = readNumber(ctx, 'packageHeight');
|
|
48
|
+
const hasDimensions = length > 0 && width > 0 && height > 0;
|
|
49
|
+
const dimensions = {
|
|
50
|
+
length,
|
|
51
|
+
width,
|
|
52
|
+
height,
|
|
53
|
+
units: readString(ctx, 'dimensionUnit', 'IN') === 'CM' ? 'CM' : 'IN',
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
weight: weight,
|
|
57
|
+
...(hasDimensions ? { dimensions: dimensions } : {}),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function requireAccountNumber(ctx) {
|
|
61
|
+
const value = readString(ctx, 'shippingAccountNumber');
|
|
62
|
+
if (!value) {
|
|
63
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'A Shipping Account Number is required for this operation.', {
|
|
64
|
+
description: 'Enter your FedEx account number in the Shipping Account Number field before running.',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../nodes/Fedex/resources/shared.ts"],"names":[],"mappings":";;AASA,gCAEC;AAED,gCAEC;AAED,kCAEC;AAED,4CAaC;AAED,4CAOC;AAGD,kDAsBC;AAGD,oDAQC;AA9ED,+CAAkD;AAQlD,SAAgB,UAAU,CAAC,GAA4B,EAAE,IAAY,EAAE,QAAQ,GAAG,EAAE;;IACnF,OAAO,MAAM,CAAC,MAAA,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,mCAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC;AAED,SAAgB,UAAU,CAAC,GAA4B,EAAE,IAAY,EAAE,QAAQ,GAAG,CAAC;;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
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IExecuteSingleFunctions, IHttpRequestOptions, IN8nHttpFullResponse, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const createFields: INodeProperties[];
|
|
3
|
+
export declare function createPreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
4
|
+
export declare function createPostReceive(this: IExecuteSingleFunctions, _items: INodeExecutionData[], response: IN8nHttpFullResponse): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFields = void 0;
|
|
4
|
+
exports.createPreSend = createPreSend;
|
|
5
|
+
exports.createPostReceive = createPostReceive;
|
|
6
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
7
|
+
const toFedexAddress_1 = require("../../cores/toFedexAddress");
|
|
8
|
+
const toFedexContact_1 = require("../../cores/toFedexContact");
|
|
9
|
+
const extractLabel_1 = require("../../cores/extractLabel");
|
|
10
|
+
const fields_1 = require("../../fields");
|
|
11
|
+
const constants_1 = require("../../constants");
|
|
12
|
+
const shared_1 = require("../shared");
|
|
13
|
+
const show = { resource: ['shipment'], operation: ['create'] };
|
|
14
|
+
exports.createFields = [
|
|
15
|
+
(0, fields_1.accountNumberField)(show),
|
|
16
|
+
...(0, fields_1.addressFields)('shipper', show),
|
|
17
|
+
...(0, fields_1.contactFields)('shipper', show),
|
|
18
|
+
...(0, fields_1.addressFields)('recipient', show, { residential: true }),
|
|
19
|
+
...(0, fields_1.contactFields)('recipient', show),
|
|
20
|
+
(0, fields_1.serviceTypeField)(show, true),
|
|
21
|
+
(0, fields_1.packagingTypeField)(show),
|
|
22
|
+
(0, fields_1.pickupTypeField)(show),
|
|
23
|
+
...(0, fields_1.packageFields)(show),
|
|
24
|
+
{
|
|
25
|
+
displayName: 'Label Format',
|
|
26
|
+
name: 'labelImageType',
|
|
27
|
+
type: 'options',
|
|
28
|
+
options: constants_1.LABEL_IMAGE_OPTIONS,
|
|
29
|
+
default: 'PDF',
|
|
30
|
+
displayOptions: { show },
|
|
31
|
+
description: 'The image format of the returned label, delivered as a binary file attachment',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Label Stock Type',
|
|
35
|
+
name: 'labelStockType',
|
|
36
|
+
type: 'options',
|
|
37
|
+
options: constants_1.LABEL_STOCK_OPTIONS,
|
|
38
|
+
default: 'PAPER_4X6',
|
|
39
|
+
displayOptions: { show },
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
async function createPreSend(requestOptions) {
|
|
43
|
+
const body = {
|
|
44
|
+
labelResponseOptions: 'LABEL',
|
|
45
|
+
accountNumber: { value: (0, shared_1.requireAccountNumber)(this) },
|
|
46
|
+
requestedShipment: {
|
|
47
|
+
shipper: {
|
|
48
|
+
address: (0, toFedexAddress_1.toFedexAddress)((0, shared_1.readAddressInput)(this, 'shipper')),
|
|
49
|
+
contact: (0, toFedexContact_1.toFedexContact)((0, shared_1.readContactInput)(this, 'shipper')),
|
|
50
|
+
},
|
|
51
|
+
recipients: [
|
|
52
|
+
{
|
|
53
|
+
address: (0, toFedexAddress_1.toFedexAddress)((0, shared_1.readAddressInput)(this, 'recipient', { residential: true })),
|
|
54
|
+
contact: (0, toFedexContact_1.toFedexContact)((0, shared_1.readContactInput)(this, 'recipient')),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
serviceType: (0, shared_1.readString)(this, 'serviceType'),
|
|
58
|
+
packagingType: (0, shared_1.readString)(this, 'packagingType', 'YOUR_PACKAGING'),
|
|
59
|
+
pickupType: (0, shared_1.readString)(this, 'pickupType', 'USE_SCHEDULED_PICKUP'),
|
|
60
|
+
shippingChargesPayment: { paymentType: 'SENDER' },
|
|
61
|
+
labelSpecification: {
|
|
62
|
+
imageType: (0, shared_1.readString)(this, 'labelImageType', 'PDF'),
|
|
63
|
+
labelStockType: (0, shared_1.readString)(this, 'labelStockType', 'PAPER_4X6'),
|
|
64
|
+
labelFormatType: 'COMMON2D',
|
|
65
|
+
},
|
|
66
|
+
requestedPackageLineItems: [(0, shared_1.readPackageLineItem)(this)],
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
return { ...requestOptions, body };
|
|
70
|
+
}
|
|
71
|
+
async function createPostReceive(_items, response) {
|
|
72
|
+
try {
|
|
73
|
+
const label = (0, extractLabel_1.extractLabel)(response.body, (0, shared_1.readString)(this, 'labelImageType', 'PDF'));
|
|
74
|
+
const binary = await this.helpers.prepareBinaryData(label.buffer, label.fileName, label.mimeType);
|
|
75
|
+
return [
|
|
76
|
+
{
|
|
77
|
+
json: { trackingNumber: label.trackingNumber, ...label.json },
|
|
78
|
+
binary: { label: binary },
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../nodes/Fedex/resources/shipment/create.ts"],"names":[],"mappings":";;;AAuDA,sCAiCC;AAED,8CAkBC;AApGD,+CAAkD;AAClD,+DAA4D;AAC5D,+DAA4D;AAC5D,2DAAwD;AACxD,yCAQsB;AACtB,+CAA2E;AAC3E,sCAAsH;AAEtH,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;AAElD,QAAA,YAAY,GAAsB;IAC9C,IAAA,2BAAkB,EAAC,IAAI,CAAC;IACxB,GAAG,IAAA,sBAAa,EAAC,SAAS,EAAE,IAAI,CAAC;IACjC,GAAG,IAAA,sBAAa,EAAC,SAAS,EAAE,IAAI,CAAC;IACjC,GAAG,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EAAE;aACzB;SACD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAc,CAAC,CAAC;IAC9D,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IExecuteSingleFunctions, IHttpRequestOptions, IN8nHttpFullResponse, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const getRatesFields: INodeProperties[];
|
|
3
|
+
export declare function getRatesPreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
4
|
+
export declare function getRatesPostReceive(this: IExecuteSingleFunctions, _items: INodeExecutionData[], response: IN8nHttpFullResponse): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRatesFields = void 0;
|
|
4
|
+
exports.getRatesPreSend = getRatesPreSend;
|
|
5
|
+
exports.getRatesPostReceive = getRatesPostReceive;
|
|
6
|
+
const toFedexAddress_1 = require("../../cores/toFedexAddress");
|
|
7
|
+
const shapeRates_1 = require("../../cores/shapeRates");
|
|
8
|
+
const fields_1 = require("../../fields");
|
|
9
|
+
const shared_1 = require("../shared");
|
|
10
|
+
const show = { resource: ['shipment'], operation: ['getRates'] };
|
|
11
|
+
exports.getRatesFields = [
|
|
12
|
+
(0, fields_1.accountNumberField)(show),
|
|
13
|
+
...(0, fields_1.addressFields)('shipper', show),
|
|
14
|
+
...(0, fields_1.addressFields)('recipient', show, { residential: true }),
|
|
15
|
+
(0, fields_1.pickupTypeField)(show),
|
|
16
|
+
(0, fields_1.serviceTypeField)(show, false),
|
|
17
|
+
...(0, fields_1.packageFields)(show),
|
|
18
|
+
];
|
|
19
|
+
async function getRatesPreSend(requestOptions) {
|
|
20
|
+
const serviceType = (0, shared_1.readString)(this, 'serviceType');
|
|
21
|
+
const body = {
|
|
22
|
+
accountNumber: { value: (0, shared_1.requireAccountNumber)(this) },
|
|
23
|
+
rateRequestControlParameters: { returnTransitTimes: true },
|
|
24
|
+
requestedShipment: {
|
|
25
|
+
shipper: { address: (0, toFedexAddress_1.toFedexAddress)((0, shared_1.readAddressInput)(this, 'shipper')) },
|
|
26
|
+
recipient: { address: (0, toFedexAddress_1.toFedexAddress)((0, shared_1.readAddressInput)(this, 'recipient', { residential: true })) },
|
|
27
|
+
pickupType: (0, shared_1.readString)(this, 'pickupType', 'USE_SCHEDULED_PICKUP'),
|
|
28
|
+
rateRequestType: ['ACCOUNT', 'LIST'],
|
|
29
|
+
requestedPackageLineItems: [(0, shared_1.readPackageLineItem)(this)],
|
|
30
|
+
...(serviceType ? { serviceType } : {}),
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
return { ...requestOptions, body };
|
|
34
|
+
}
|
|
35
|
+
async function getRatesPostReceive(_items, response) {
|
|
36
|
+
return (0, shapeRates_1.shapeRates)(response.body).map((rate) => ({ json: rate }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=getRates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRates.js","sourceRoot":"","sources":["../../../../../nodes/Fedex/resources/shipment/getRates.ts"],"names":[],"mappings":";;;AA8BA,0CAoBC;AAED,kDAMC;AAlDD,+DAA4D;AAC5D,uDAAoD;AACpD,yCAMsB;AACtB,sCAAoG;AAEpG,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;AAEpD,QAAA,cAAc,GAAsB;IAChD,IAAA,2BAAkB,EAAC,IAAI,CAAC;IACxB,GAAG,IAAA,sBAAa,EAAC,SAAS,EAAE,IAAI,CAAC;IACjC,GAAG,IAAA,sBAAa,EAAC,WAAW,EAAE,IAAI,EAAE,EAAE,WAAW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AE,CAAC,CAAC,EAAE,IAAI,EAAE,IAA8B,EAAE,CAAC,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shipmentDescription = void 0;
|
|
4
|
+
const track_1 = require("./track");
|
|
5
|
+
const getRates_1 = require("./getRates");
|
|
6
|
+
const create_1 = require("./create");
|
|
7
|
+
const showForShipment = { resource: ['shipment'] };
|
|
8
|
+
exports.shipmentDescription = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'Operation',
|
|
11
|
+
name: 'operation',
|
|
12
|
+
type: 'options',
|
|
13
|
+
noDataExpression: true,
|
|
14
|
+
displayOptions: { show: showForShipment },
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Track',
|
|
18
|
+
value: 'track',
|
|
19
|
+
action: 'Track a shipment',
|
|
20
|
+
description: 'Get the status and scan history for a tracking number',
|
|
21
|
+
routing: {
|
|
22
|
+
request: { method: 'POST', url: '/track/v1/trackingnumbers' },
|
|
23
|
+
send: { preSend: [track_1.trackPreSend] },
|
|
24
|
+
output: { postReceive: [{ type: 'rootProperty', properties: { property: 'output.completeTrackResults' } }] },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Get Rates',
|
|
29
|
+
value: 'getRates',
|
|
30
|
+
action: 'Get rates for a shipment',
|
|
31
|
+
description: 'Quote negotiated and list rates for available services',
|
|
32
|
+
routing: {
|
|
33
|
+
request: { method: 'POST', url: '/rate/v1/rates/quotes' },
|
|
34
|
+
send: { preSend: [getRates_1.getRatesPreSend] },
|
|
35
|
+
output: { postReceive: [getRates_1.getRatesPostReceive] },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Create',
|
|
40
|
+
value: 'create',
|
|
41
|
+
action: 'Create a shipment and label',
|
|
42
|
+
description: 'Buy a shipment and get a printable label plus tracking number',
|
|
43
|
+
routing: {
|
|
44
|
+
request: { method: 'POST', url: '/ship/v1/shipments' },
|
|
45
|
+
send: { preSend: [create_1.createPreSend] },
|
|
46
|
+
output: { postReceive: [create_1.createPostReceive] },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
default: 'track',
|
|
51
|
+
},
|
|
52
|
+
...track_1.trackFields,
|
|
53
|
+
...getRates_1.getRatesFields,
|
|
54
|
+
...create_1.createFields,
|
|
55
|
+
];
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Fedex/resources/shipment/index.ts"],"names":[],"mappings":";;;AACA,mCAAoD;AACpD,yCAAkF;AAClF,qCAA0E;AAE1E,MAAM,eAAe,GAAG,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;AAEtC,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,eAAe,EAAE;QACzC,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,kBAAkB;gBAC1B,WAAW,EAAE,uDAAuD;gBACpE,OAAO,EAAE;oBACR,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,2BAA2B,EAAE;oBAC7D,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,oBAAY,CAAC,EAAE;oBACjC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,6BAA6B,EAAE,EAAE,CAAC,EAAE;iBAC5G;aACD;YACD;gBACC,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,0BAA0B;gBAClC,WAAW,EAAE,wDAAwD;gBACrE,OAAO,EAAE;oBACR,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,uBAAuB,EAAE;oBACzD,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,0BAAe,CAAC,EAAE;oBACpC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,8BAAmB,CAAC,EAAE;iBAC9C;aACD;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,6BAA6B;gBACrC,WAAW,EAAE,+DAA+D;gBAC5E,OAAO,EAAE;oBACR,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,oBAAoB,EAAE;oBACtD,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,sBAAa,CAAC,EAAE;oBAClC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,0BAAiB,CAAC,EAAE;iBAC5C;aACD;SACD;QACD,OAAO,EAAE,OAAO;KAChB;IACD,GAAG,mBAAW;IACd,GAAG,yBAAc;IACjB,GAAG,qBAAY;CACf,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IExecuteSingleFunctions, IHttpRequestOptions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const trackFields: INodeProperties[];
|
|
3
|
+
export declare function trackPreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|