n8n-nodes-sendit 1.2.0 → 1.2.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/dist/nodes/SendIt/SendIt.node.js +2 -1
- package/dist/nodes/SendIt/handlers/advanced.js +2 -2
- package/dist/nodes/SendIt/handlers/connect.js +2 -2
- package/dist/nodes/SendIt/handlers/conversions.js +1 -1
- package/dist/nodes/SendIt/helpers.d.ts +1 -1
- package/dist/nodes/SendIt/helpers.js +3 -2
- package/package.json +1 -1
|
@@ -1777,7 +1777,7 @@ class SendIt {
|
|
|
1777
1777
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`);
|
|
1778
1778
|
}
|
|
1779
1779
|
const response = await handler(this, operation, i, optionalHeaders);
|
|
1780
|
-
returnData.push({ json: (0, helpers_1.normalizeResponse)(response) });
|
|
1780
|
+
returnData.push({ json: (0, helpers_1.normalizeResponse)(response), pairedItem: { item: i } });
|
|
1781
1781
|
}
|
|
1782
1782
|
catch (error) {
|
|
1783
1783
|
if (this.continueOnFail()) {
|
|
@@ -1785,6 +1785,7 @@ class SendIt {
|
|
|
1785
1785
|
json: {
|
|
1786
1786
|
error: error.message,
|
|
1787
1787
|
},
|
|
1788
|
+
pairedItem: { item: i },
|
|
1788
1789
|
});
|
|
1789
1790
|
continue;
|
|
1790
1791
|
}
|
|
@@ -19,8 +19,8 @@ const handleAdvanced = async (context, operation, i, optionalHeaders) => {
|
|
|
19
19
|
if (!/^\/api\/v[12]\//.test(normalizedPath)) {
|
|
20
20
|
throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'Advanced path must start with /api/v1/ or /api/v2/');
|
|
21
21
|
}
|
|
22
|
-
const parsedQuery = (0, helpers_1.parseJsonInput)(queryJson, 'Query JSON');
|
|
23
|
-
const parsedBody = (0, helpers_1.parseJsonInput)(bodyJson, 'Body JSON');
|
|
22
|
+
const parsedQuery = (0, helpers_1.parseJsonInput)(context, queryJson, 'Query JSON');
|
|
23
|
+
const parsedBody = (0, helpers_1.parseJsonInput)(context, bodyJson, 'Body JSON');
|
|
24
24
|
const qs = parsedQuery ? (0, helpers_1.assertObject)(parsedQuery, 'Query JSON must parse to an object') : undefined;
|
|
25
25
|
const body = parsedBody === undefined ? undefined : parsedBody;
|
|
26
26
|
return (0, helpers_1.sendRequest)(context, {
|
|
@@ -14,7 +14,7 @@ const handleConnect = async (context, operation, i, optionalHeaders) => {
|
|
|
14
14
|
if (operation === 'connectToken') {
|
|
15
15
|
const platform = context.getNodeParameter('connectPlatform', i);
|
|
16
16
|
const credentialsJson = context.getNodeParameter('connectCredentialsJson', i);
|
|
17
|
-
const parsed = (0, helpers_1.parseJsonInput)(credentialsJson, 'Credentials JSON');
|
|
17
|
+
const parsed = (0, helpers_1.parseJsonInput)(context, credentialsJson, 'Credentials JSON');
|
|
18
18
|
const credentials = (0, helpers_1.assertObject)(parsed, 'Credentials JSON must parse to an object');
|
|
19
19
|
return (0, helpers_1.sendRequest)(context, {
|
|
20
20
|
method: 'POST',
|
|
@@ -27,7 +27,7 @@ const handleConnect = async (context, operation, i, optionalHeaders) => {
|
|
|
27
27
|
const platform = context.getNodeParameter('connectPlatform', i);
|
|
28
28
|
const webhookUrl = context.getNodeParameter('connectWebhookUrl', i);
|
|
29
29
|
const metadataJson = context.getNodeParameter('connectMetadataJson', i);
|
|
30
|
-
const parsedMetadata = (0, helpers_1.parseJsonInput)(metadataJson, 'Metadata JSON');
|
|
30
|
+
const parsedMetadata = (0, helpers_1.parseJsonInput)(context, metadataJson, 'Metadata JSON');
|
|
31
31
|
const metadata = parsedMetadata ? (0, helpers_1.assertObject)(parsedMetadata, 'Metadata JSON must parse to an object') : undefined;
|
|
32
32
|
return (0, helpers_1.sendRequest)(context, {
|
|
33
33
|
method: 'POST',
|
|
@@ -10,7 +10,7 @@ const handleConversions = async (context, operation, i, optionalHeaders) => {
|
|
|
10
10
|
const conversionType = context.getNodeParameter('conversionType', i);
|
|
11
11
|
const value = context.getNodeParameter('conversionValue', i);
|
|
12
12
|
const metadataJson = context.getNodeParameter('conversionMetadataJson', i);
|
|
13
|
-
const metadata = (0, helpers_1.parseJsonInput)(metadataJson, 'Conversion Metadata JSON');
|
|
13
|
+
const metadata = (0, helpers_1.parseJsonInput)(context, metadataJson, 'Conversion Metadata JSON');
|
|
14
14
|
const body = {};
|
|
15
15
|
if (trackedLinkId)
|
|
16
16
|
body.trackedLinkId = trackedLinkId;
|
|
@@ -3,7 +3,7 @@ export declare function getOptionalString(value: unknown): string | undefined;
|
|
|
3
3
|
export declare function buildOptionalHeaders(teamId?: string, idempotencyKey?: string): Record<string, string>;
|
|
4
4
|
export declare function parseCsvList(value: string | undefined): string[] | undefined;
|
|
5
5
|
export declare function maybeArray(value: unknown): string[] | undefined;
|
|
6
|
-
export declare function parseJsonInput(value: string | undefined, label: string): unknown;
|
|
6
|
+
export declare function parseJsonInput(context: IExecuteFunctions, value: string | undefined, label: string): unknown;
|
|
7
7
|
export declare function normalizeResponse(response: unknown): IDataObject;
|
|
8
8
|
export declare function sendRequest(context: IExecuteFunctions, request: {
|
|
9
9
|
method: IHttpRequestMethods;
|
|
@@ -10,6 +10,7 @@ exports.sendRequest = sendRequest;
|
|
|
10
10
|
exports.assertObject = assertObject;
|
|
11
11
|
exports.buildAiBody = buildAiBody;
|
|
12
12
|
exports.buildLibraryBody = buildLibraryBody;
|
|
13
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
13
14
|
const constants_1 = require("./constants");
|
|
14
15
|
function getOptionalString(value) {
|
|
15
16
|
if (typeof value !== 'string') {
|
|
@@ -50,7 +51,7 @@ function maybeArray(value) {
|
|
|
50
51
|
}
|
|
51
52
|
return undefined;
|
|
52
53
|
}
|
|
53
|
-
function parseJsonInput(value, label) {
|
|
54
|
+
function parseJsonInput(context, value, label) {
|
|
54
55
|
if (!value || value.trim().length === 0) {
|
|
55
56
|
return undefined;
|
|
56
57
|
}
|
|
@@ -58,7 +59,7 @@ function parseJsonInput(value, label) {
|
|
|
58
59
|
return JSON.parse(value);
|
|
59
60
|
}
|
|
60
61
|
catch {
|
|
61
|
-
throw new
|
|
62
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `${label} must be valid JSON`);
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
function normalizeResponse(response) {
|