n8n-resend 1.0.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/LICENSE +21 -0
- package/README.md +256 -0
- package/dist/credentials/ResendApi.credentials.d.ts +10 -0
- package/dist/credentials/ResendApi.credentials.d.ts.map +1 -0
- package/dist/credentials/ResendApi.credentials.js +40 -0
- package/dist/credentials/ResendApi.credentials.js.map +1 -0
- package/dist/nodes/Resend/Resend.node.d.ts +14 -0
- package/dist/nodes/Resend/Resend.node.d.ts.map +1 -0
- package/dist/nodes/Resend/Resend.node.js +55 -0
- package/dist/nodes/Resend/Resend.node.js.map +1 -0
- package/dist/nodes/Resend/ResendTrigger.node.d.ts +13 -0
- package/dist/nodes/Resend/ResendTrigger.node.d.ts.map +1 -0
- package/dist/nodes/Resend/ResendTrigger.node.js +210 -0
- package/dist/nodes/Resend/ResendTrigger.node.js.map +1 -0
- package/dist/nodes/Resend/constants.d.ts +12 -0
- package/dist/nodes/Resend/constants.d.ts.map +1 -0
- package/dist/nodes/Resend/constants.js +15 -0
- package/dist/nodes/Resend/constants.js.map +1 -0
- package/dist/nodes/Resend/resend.svg +3 -0
- package/dist/nodes/Resend/resources/broadcasts.d.ts +3 -0
- package/dist/nodes/Resend/resources/broadcasts.d.ts.map +1 -0
- package/dist/nodes/Resend/resources/broadcasts.js +330 -0
- package/dist/nodes/Resend/resources/broadcasts.js.map +1 -0
- package/dist/nodes/Resend/resources/contacts.d.ts +3 -0
- package/dist/nodes/Resend/resources/contacts.d.ts.map +1 -0
- package/dist/nodes/Resend/resources/contacts.js +269 -0
- package/dist/nodes/Resend/resources/contacts.js.map +1 -0
- package/dist/nodes/Resend/resources/emails.d.ts +3 -0
- package/dist/nodes/Resend/resources/emails.d.ts.map +1 -0
- package/dist/nodes/Resend/resources/emails.js +417 -0
- package/dist/nodes/Resend/resources/emails.js.map +1 -0
- package/dist/nodes/Resend/resources/index.d.ts +7 -0
- package/dist/nodes/Resend/resources/index.d.ts.map +1 -0
- package/dist/nodes/Resend/resources/index.js +16 -0
- package/dist/nodes/Resend/resources/index.js.map +1 -0
- package/dist/nodes/Resend/resources/segments.d.ts +3 -0
- package/dist/nodes/Resend/resources/segments.d.ts.map +1 -0
- package/dist/nodes/Resend/resources/segments.js +137 -0
- package/dist/nodes/Resend/resources/segments.js.map +1 -0
- package/dist/nodes/Resend/resources/templates.d.ts +3 -0
- package/dist/nodes/Resend/resources/templates.d.ts.map +1 -0
- package/dist/nodes/Resend/resources/templates.js +48 -0
- package/dist/nodes/Resend/resources/templates.js.map +1 -0
- package/dist/nodes/Resend/resources/topics.d.ts +3 -0
- package/dist/nodes/Resend/resources/topics.d.ts.map +1 -0
- package/dist/nodes/Resend/resources/topics.js +210 -0
- package/dist/nodes/Resend/resources/topics.js.map +1 -0
- package/dist/nodes/Resend/types.d.ts +146 -0
- package/dist/nodes/Resend/types.d.ts.map +1 -0
- package/dist/nodes/Resend/types.js +3 -0
- package/dist/nodes/Resend/types.js.map +1 -0
- package/dist/nodes/Resend/utils/attachmentHelpers.d.ts +15 -0
- package/dist/nodes/Resend/utils/attachmentHelpers.d.ts.map +1 -0
- package/dist/nodes/Resend/utils/attachmentHelpers.js +91 -0
- package/dist/nodes/Resend/utils/attachmentHelpers.js.map +1 -0
- package/dist/nodes/Resend/utils/commonFields.d.ts +9 -0
- package/dist/nodes/Resend/utils/commonFields.d.ts.map +1 -0
- package/dist/nodes/Resend/utils/commonFields.js +82 -0
- package/dist/nodes/Resend/utils/commonFields.js.map +1 -0
- package/dist/nodes/Resend/utils/fieldBuilders.d.ts +8 -0
- package/dist/nodes/Resend/utils/fieldBuilders.d.ts.map +1 -0
- package/dist/nodes/Resend/utils/fieldBuilders.js +226 -0
- package/dist/nodes/Resend/utils/fieldBuilders.js.map +1 -0
- package/dist/nodes/Resend/utils/loadOptionsHelpers.d.ts +18 -0
- package/dist/nodes/Resend/utils/loadOptionsHelpers.d.ts.map +1 -0
- package/dist/nodes/Resend/utils/loadOptionsHelpers.js +128 -0
- package/dist/nodes/Resend/utils/loadOptionsHelpers.js.map +1 -0
- package/dist/nodes/Resend/utils/nodeBuilder.d.ts +4 -0
- package/dist/nodes/Resend/utils/nodeBuilder.d.ts.map +1 -0
- package/dist/nodes/Resend/utils/nodeBuilder.js +44 -0
- package/dist/nodes/Resend/utils/nodeBuilder.js.map +1 -0
- package/dist/nodes/Resend/utils/requestBuilders.d.ts +18 -0
- package/dist/nodes/Resend/utils/requestBuilders.d.ts.map +1 -0
- package/dist/nodes/Resend/utils/requestBuilders.js +55 -0
- package/dist/nodes/Resend/utils/requestBuilders.js.map +1 -0
- package/dist/nodes/Resend/utils/templateHelpers.d.ts +17 -0
- package/dist/nodes/Resend/utils/templateHelpers.d.ts.map +1 -0
- package/dist/nodes/Resend/utils/templateHelpers.js +63 -0
- package/dist/nodes/Resend/utils/templateHelpers.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { ResendResource } from '../types';
|
|
3
|
+
export declare function buildAttachmentField(resource: ResendResource, operations: string[]): INodeProperties;
|
|
4
|
+
export declare function buildTemplateVariablesField(resource: ResendResource, operations: string[]): INodeProperties;
|
|
5
|
+
export declare function buildKeyValuePairField(displayName: string, name: string, resource: ResendResource, operations: string[], description: string, itemName?: string): INodeProperties;
|
|
6
|
+
export declare function buildContactPropertiesField(resource: ResendResource, operations: string[]): INodeProperties;
|
|
7
|
+
export declare function buildEmailArrayField(displayName: string, name: string, resource: ResendResource, operations: string[], required?: boolean, description?: string): INodeProperties;
|
|
8
|
+
//# sourceMappingURL=fieldBuilders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldBuilders.d.ts","sourceRoot":"","sources":["../../../../nodes/Resend/utils/fieldBuilders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,wBAAgB,oBAAoB,CACnC,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,MAAM,EAAE,GAClB,eAAe,CAyDjB;AAED,wBAAgB,2BAA2B,CAC1C,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,MAAM,EAAE,GAClB,eAAe,CA4CjB;AAED,wBAAgB,sBAAsB,CACrC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,MAAM,EACnB,QAAQ,GAAE,MAAe,GACvB,eAAe,CAuCjB;AAED,wBAAgB,2BAA2B,CAC1C,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,MAAM,EAAE,GAClB,eAAe,CAyDjB;AAED,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,MAAM,EAAE,EACpB,QAAQ,GAAE,OAAe,EACzB,WAAW,GAAE,MAAkD,GAC7D,eAAe,CAgBjB"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildEmailArrayField = exports.buildContactPropertiesField = exports.buildKeyValuePairField = exports.buildTemplateVariablesField = exports.buildAttachmentField = void 0;
|
|
4
|
+
function buildAttachmentField(resource, operations) {
|
|
5
|
+
return {
|
|
6
|
+
displayName: 'Attachments',
|
|
7
|
+
name: 'attachments',
|
|
8
|
+
type: 'fixedCollection',
|
|
9
|
+
default: {},
|
|
10
|
+
typeOptions: {
|
|
11
|
+
multipleValues: true,
|
|
12
|
+
},
|
|
13
|
+
displayOptions: {
|
|
14
|
+
show: {
|
|
15
|
+
resource: [resource],
|
|
16
|
+
operation: operations,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
options: [
|
|
20
|
+
{
|
|
21
|
+
name: 'attachment',
|
|
22
|
+
displayName: 'Attachment',
|
|
23
|
+
values: [
|
|
24
|
+
{
|
|
25
|
+
displayName: 'Binary Property',
|
|
26
|
+
name: 'binaryPropertyName',
|
|
27
|
+
type: 'string',
|
|
28
|
+
default: 'data',
|
|
29
|
+
description: 'Name of the binary property containing the attachment data',
|
|
30
|
+
placeholder: 'data',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Filename',
|
|
34
|
+
name: 'filename',
|
|
35
|
+
type: 'string',
|
|
36
|
+
default: '',
|
|
37
|
+
description: 'Name of the file (optional if using binary property)',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Content Type',
|
|
41
|
+
name: 'contentType',
|
|
42
|
+
type: 'string',
|
|
43
|
+
default: '',
|
|
44
|
+
placeholder: 'image/png',
|
|
45
|
+
description: 'MIME type of the attachment (optional)',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
displayName: 'Content ID (CID)',
|
|
49
|
+
name: 'contentId',
|
|
50
|
+
type: 'string',
|
|
51
|
+
default: '',
|
|
52
|
+
placeholder: 'logo-image',
|
|
53
|
+
description: 'For inline images - reference in HTML as <img src="cid:logo-image">',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
description: 'Attachments to include in the email',
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.buildAttachmentField = buildAttachmentField;
|
|
62
|
+
function buildTemplateVariablesField(resource, operations) {
|
|
63
|
+
return {
|
|
64
|
+
displayName: 'Template Variables',
|
|
65
|
+
name: 'templateVariables',
|
|
66
|
+
type: 'fixedCollection',
|
|
67
|
+
default: {},
|
|
68
|
+
typeOptions: {
|
|
69
|
+
multipleValues: true,
|
|
70
|
+
},
|
|
71
|
+
displayOptions: {
|
|
72
|
+
show: {
|
|
73
|
+
resource: [resource],
|
|
74
|
+
operation: operations,
|
|
75
|
+
useTemplate: [true],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
options: [
|
|
79
|
+
{
|
|
80
|
+
name: 'variable',
|
|
81
|
+
displayName: 'Variable',
|
|
82
|
+
values: [
|
|
83
|
+
{
|
|
84
|
+
displayName: 'Variable Name',
|
|
85
|
+
name: 'key',
|
|
86
|
+
type: 'options',
|
|
87
|
+
typeOptions: {
|
|
88
|
+
loadOptionsMethod: 'getTemplateVariables',
|
|
89
|
+
loadOptionsDependsOn: ['templateId'],
|
|
90
|
+
},
|
|
91
|
+
default: '',
|
|
92
|
+
description: 'Select a variable from the template',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Value',
|
|
96
|
+
name: 'value',
|
|
97
|
+
type: 'string',
|
|
98
|
+
default: '',
|
|
99
|
+
description: 'Variable value (numbers will be auto-detected)',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
description: 'Variables to inject into the template',
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
exports.buildTemplateVariablesField = buildTemplateVariablesField;
|
|
108
|
+
function buildKeyValuePairField(displayName, name, resource, operations, description, itemName = 'pair') {
|
|
109
|
+
return {
|
|
110
|
+
displayName,
|
|
111
|
+
name,
|
|
112
|
+
type: 'fixedCollection',
|
|
113
|
+
default: {},
|
|
114
|
+
typeOptions: {
|
|
115
|
+
multipleValues: true,
|
|
116
|
+
},
|
|
117
|
+
displayOptions: {
|
|
118
|
+
show: {
|
|
119
|
+
resource: [resource],
|
|
120
|
+
operation: operations,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
options: [
|
|
124
|
+
{
|
|
125
|
+
name: itemName,
|
|
126
|
+
displayName: 'Item',
|
|
127
|
+
values: [
|
|
128
|
+
{
|
|
129
|
+
displayName: 'Key',
|
|
130
|
+
name: 'key',
|
|
131
|
+
type: 'string',
|
|
132
|
+
default: '',
|
|
133
|
+
description: 'The key name',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
displayName: 'Value',
|
|
137
|
+
name: 'value',
|
|
138
|
+
type: 'string',
|
|
139
|
+
default: '',
|
|
140
|
+
description: 'The value',
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
description,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
exports.buildKeyValuePairField = buildKeyValuePairField;
|
|
149
|
+
function buildContactPropertiesField(resource, operations) {
|
|
150
|
+
return {
|
|
151
|
+
displayName: 'Custom Properties',
|
|
152
|
+
name: 'properties',
|
|
153
|
+
type: 'fixedCollection',
|
|
154
|
+
default: {},
|
|
155
|
+
typeOptions: {
|
|
156
|
+
multipleValues: true,
|
|
157
|
+
},
|
|
158
|
+
displayOptions: {
|
|
159
|
+
show: {
|
|
160
|
+
resource: [resource],
|
|
161
|
+
operation: operations,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
options: [
|
|
165
|
+
{
|
|
166
|
+
name: 'property',
|
|
167
|
+
displayName: 'Property',
|
|
168
|
+
values: [
|
|
169
|
+
{
|
|
170
|
+
displayName: 'Key',
|
|
171
|
+
name: 'key',
|
|
172
|
+
type: 'string',
|
|
173
|
+
default: '',
|
|
174
|
+
description: 'Property key name',
|
|
175
|
+
placeholder: 'company_name',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
displayName: 'Value',
|
|
179
|
+
name: 'value',
|
|
180
|
+
type: 'string',
|
|
181
|
+
default: '',
|
|
182
|
+
description: 'Property value',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
displayName: 'Type',
|
|
186
|
+
name: 'type',
|
|
187
|
+
type: 'options',
|
|
188
|
+
options: [
|
|
189
|
+
{
|
|
190
|
+
name: 'String',
|
|
191
|
+
value: 'string',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'Number',
|
|
195
|
+
value: 'number',
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
default: 'string',
|
|
199
|
+
description: 'Data type of the property value',
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
description: 'Custom properties for the contact',
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
exports.buildContactPropertiesField = buildContactPropertiesField;
|
|
208
|
+
function buildEmailArrayField(displayName, name, resource, operations, required = false, description = 'Comma-separated list of email addresses') {
|
|
209
|
+
return {
|
|
210
|
+
displayName,
|
|
211
|
+
name,
|
|
212
|
+
type: 'string',
|
|
213
|
+
default: '',
|
|
214
|
+
required,
|
|
215
|
+
displayOptions: {
|
|
216
|
+
show: {
|
|
217
|
+
resource: [resource],
|
|
218
|
+
operation: operations,
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
description,
|
|
222
|
+
placeholder: 'user@example.com, another@example.com',
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
exports.buildEmailArrayField = buildEmailArrayField;
|
|
226
|
+
//# sourceMappingURL=fieldBuilders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldBuilders.js","sourceRoot":"","sources":["../../../../nodes/Resend/utils/fieldBuilders.ts"],"names":[],"mappings":";;;AAGA,SAAgB,oBAAoB,CACnC,QAAwB,EACxB,UAAoB;IAEpB,OAAO;QACN,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,EAAE;QACX,WAAW,EAAE;YACZ,cAAc,EAAE,IAAI;SACpB;QACD,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBACpB,SAAS,EAAE,UAAU;aACrB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,YAAY;gBAClB,WAAW,EAAE,YAAY;gBACzB,MAAM,EAAE;oBACP;wBACC,WAAW,EAAE,iBAAiB;wBAC9B,IAA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AAC,QAAQ,CAAC;gBACpB,SAAS,EAAE,UAAU;aACrB;SACD;QACD,WAAW;QACX,WAAW,EAAE,uCAAuC;KACpD,CAAC;AACH,CAAC;AAvBD,oDAuBC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
|
2
|
+
/**
|
|
3
|
+
* Load segments for dropdown selection
|
|
4
|
+
*/
|
|
5
|
+
export declare function getSegments(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Load topics for dropdown selection
|
|
8
|
+
*/
|
|
9
|
+
export declare function getTopics(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Load templates for dropdown selection
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTemplates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Load template variables for dynamic field generation
|
|
16
|
+
*/
|
|
17
|
+
export declare function getTemplateVariables(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
18
|
+
//# sourceMappingURL=loadOptionsHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadOptionsHelpers.d.ts","sourceRoot":"","sources":["../../../../nodes/Resend/utils/loadOptionsHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAG3E;;GAEG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAqB9F;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA4B5F;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA0B/F;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACzC,IAAI,EAAE,qBAAqB,GACzB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAqCjC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTemplateVariables = exports.getTemplates = exports.getTopics = exports.getSegments = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Load segments for dropdown selection
|
|
6
|
+
*/
|
|
7
|
+
async function getSegments() {
|
|
8
|
+
try {
|
|
9
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'resendApi', {
|
|
10
|
+
method: 'GET',
|
|
11
|
+
url: 'https://api.resend.com/segments',
|
|
12
|
+
}));
|
|
13
|
+
const segments = response.data || [];
|
|
14
|
+
return segments.map((segment) => ({
|
|
15
|
+
name: segment.name,
|
|
16
|
+
value: segment.id,
|
|
17
|
+
description: segment.description || undefined,
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
name: 'Error loading segments',
|
|
24
|
+
value: 'error',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.getSegments = getSegments;
|
|
30
|
+
/**
|
|
31
|
+
* Load topics for dropdown selection
|
|
32
|
+
*/
|
|
33
|
+
async function getTopics() {
|
|
34
|
+
try {
|
|
35
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'resendApi', {
|
|
36
|
+
method: 'GET',
|
|
37
|
+
url: 'https://api.resend.com/topics',
|
|
38
|
+
}));
|
|
39
|
+
const topics = response.data || [];
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
name: 'None (No topic)',
|
|
43
|
+
value: '',
|
|
44
|
+
description: 'Do not assign a topic to this email',
|
|
45
|
+
},
|
|
46
|
+
...topics.map((topic) => ({
|
|
47
|
+
name: topic.name,
|
|
48
|
+
value: topic.id,
|
|
49
|
+
description: topic.description || `Default: ${topic.default_subscription}`,
|
|
50
|
+
})),
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return [
|
|
55
|
+
{
|
|
56
|
+
name: 'Error loading topics',
|
|
57
|
+
value: 'error',
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.getTopics = getTopics;
|
|
63
|
+
/**
|
|
64
|
+
* Load templates for dropdown selection
|
|
65
|
+
*/
|
|
66
|
+
async function getTemplates() {
|
|
67
|
+
try {
|
|
68
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'resendApi', {
|
|
69
|
+
method: 'GET',
|
|
70
|
+
url: 'https://api.resend.com/templates',
|
|
71
|
+
}));
|
|
72
|
+
const templates = response.data || [];
|
|
73
|
+
// Only show published templates
|
|
74
|
+
const publishedTemplates = templates.filter((template) => template.status === 'published');
|
|
75
|
+
return publishedTemplates.map((template) => ({
|
|
76
|
+
name: template.name,
|
|
77
|
+
value: template.id,
|
|
78
|
+
description: template.alias ? `Alias: ${template.alias}` : undefined,
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return [
|
|
83
|
+
{
|
|
84
|
+
name: 'Error loading templates',
|
|
85
|
+
value: 'error',
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.getTemplates = getTemplates;
|
|
91
|
+
/**
|
|
92
|
+
* Load template variables for dynamic field generation
|
|
93
|
+
*/
|
|
94
|
+
async function getTemplateVariables() {
|
|
95
|
+
try {
|
|
96
|
+
const templateId = this.getNodeParameter('templateId');
|
|
97
|
+
if (!templateId || templateId === '') {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
const template = (await this.helpers.httpRequestWithAuthentication.call(this, 'resendApi', {
|
|
101
|
+
method: 'GET',
|
|
102
|
+
url: `https://api.resend.com/templates/${templateId}`,
|
|
103
|
+
}));
|
|
104
|
+
if (!template.variables || template.variables.length === 0) {
|
|
105
|
+
return [
|
|
106
|
+
{
|
|
107
|
+
name: 'No variables defined in this template',
|
|
108
|
+
value: '__no_variables__',
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
return template.variables.map((variable) => ({
|
|
113
|
+
name: `${variable.key}${variable.fallback_value ? ` (default: ${variable.fallback_value})` : ''}`,
|
|
114
|
+
value: variable.key,
|
|
115
|
+
description: `Type: ${variable.type}`,
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
return [
|
|
120
|
+
{
|
|
121
|
+
name: 'Error loading template variables',
|
|
122
|
+
value: 'error',
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.getTemplateVariables = getTemplateVariables;
|
|
128
|
+
//# sourceMappingURL=loadOptionsHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadOptionsHelpers.js","sourceRoot":"","sources":["../../../../nodes/Resend/utils/loadOptionsHelpers.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACI,KAAK,UAAU,WAAW;IAChC,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE;YAC1F,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,iCAAiC;SACtC,CAAC,CAA+B,CAAC;QAElC,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;QACrC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC;YAC1C,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,E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,KAAK,CAAC,EAAE,CAAC;YAC5D,OAAO;gBACN;oBACC,IAAI,EAAE,uCAAuC;oBAC7C,KAAK,EAAE,kBAAkB;iBACzB;aACD,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC5C,IAAI,EAAE,GAAG,QAAQ,CAAC,GAAG,GACpB,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,QAAQ,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,EACtE,EAAE;YACF,KAAK,EAAE,QAAQ,CAAC,GAAG;YACnB,WAAW,EAAE,SAAS,QAAQ,CAAC,IAAI,EAAE;SACrC,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO;YACN;gBACC,IAAI,EAAE,kCAAkC;gBACxC,KAAK,EAAE,OAAO;aACd;SACD,CAAC;IACH,CAAC;AACF,CAAC;AAvCD,oDAuCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeBuilder.d.ts","sourceRoot":"","sources":["../../../../nodes/Resend/utils/nodeBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGhD,wBAAgB,eAAe,CAAC,SAAS,EAAE,oBAAoB,EAAE,GAAG,eAAe,EAAE,CAyCpF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildResendNode = void 0;
|
|
4
|
+
const commonFields_1 = require("./commonFields");
|
|
5
|
+
function buildResendNode(resources) {
|
|
6
|
+
const properties = [];
|
|
7
|
+
// 1. Add resource selector
|
|
8
|
+
const resourceOptions = resources.map((r) => ({
|
|
9
|
+
name: r.description.displayName,
|
|
10
|
+
value: r.description.value,
|
|
11
|
+
}));
|
|
12
|
+
properties.push((0, commonFields_1.buildResourceField)(resourceOptions));
|
|
13
|
+
// 2. Add operation selectors for each resource
|
|
14
|
+
for (const resource of resources) {
|
|
15
|
+
const operationField = {
|
|
16
|
+
displayName: 'Operation',
|
|
17
|
+
name: 'operation',
|
|
18
|
+
type: 'options',
|
|
19
|
+
noDataExpression: true,
|
|
20
|
+
displayOptions: {
|
|
21
|
+
show: {
|
|
22
|
+
resource: [resource.description.value],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
options: resource.operations.map((op) => ({
|
|
26
|
+
name: op.name,
|
|
27
|
+
value: op.value,
|
|
28
|
+
description: op.description,
|
|
29
|
+
action: op.action,
|
|
30
|
+
routing: op.routing,
|
|
31
|
+
})),
|
|
32
|
+
default: resource.operations[0]?.value || '',
|
|
33
|
+
description: 'The operation to perform',
|
|
34
|
+
};
|
|
35
|
+
properties.push(operationField);
|
|
36
|
+
}
|
|
37
|
+
// 3. Add all fields from all resources
|
|
38
|
+
for (const resource of resources) {
|
|
39
|
+
properties.push(...resource.fields);
|
|
40
|
+
}
|
|
41
|
+
return properties;
|
|
42
|
+
}
|
|
43
|
+
exports.buildResendNode = buildResendNode;
|
|
44
|
+
//# sourceMappingURL=nodeBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeBuilder.js","sourceRoot":"","sources":["../../../../nodes/Resend/utils/nodeBuilder.ts"],"names":[],"mappings":";;;AAEA,iDAAoD;AAEpD,SAAgB,eAAe,CAAC,SAAiC;IAChE,MAAM,UAAU,GAAsB,EAAE,CAAC;IAEzC,2BAA2B;IAC3B,MAAM,eAAe,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7C,IAAI,EAAE,CAAC,CAAC,WAAW,CAAC,WAAW;QAC/B,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,KAAK;KAC1B,CAAC,CAAC,CAAC;IACJ,UAAU,CAAC,IAAI,CAAC,IAAA,iCAAkB,EAAC,eAAe,CAAC,CAAC,CAAC;IAErD,+CAA+C;IAC/C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAClC,MAAM,cAAc,GAAoB;YACvC,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,SAAS;YACf,gBAAgB,EAAE,IAAI;YACtB,cAAc,EAAE;gBACf,IAAI,EAAE;oBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC;iBACtC;aACD;YACD,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBACzC,IAAI,EAAE,EAAE,CAAC,IAAI;gBACb,KAAK,EAAE,EAAE,CAAC,KAAK;gBACf,WAAW,EAAE,EAAE,CAAC,WAAW;gBAC3B,MAAM,EAAE,EAAE,CAAC,MAAM;gBACjB,OAAO,EAAE,EAAE,CAAC,OAAO;aACnB,CAAC,CAAC;YACH,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE;YAC5C,WAAW,EAAE,0BAA0B;SACvC,CAAC;QACF,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;IAED,uCAAuC;IACvC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAClC,UAAU,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC;AAzCD,0CAyCC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IExecuteSingleFunctions, IHttpRequestOptions } from 'n8n-workflow';
|
|
2
|
+
/**
|
|
3
|
+
* Shared preSend hook for pagination across all resources
|
|
4
|
+
*/
|
|
5
|
+
export declare function preparePaginatedRequest(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
6
|
+
/**
|
|
7
|
+
* Process template or HTML content for emails and broadcasts
|
|
8
|
+
* @param context - The n8n execution context
|
|
9
|
+
* @param includeSubject - Whether to include subject field when not using template
|
|
10
|
+
* @returns Object with template or html/text/subject fields
|
|
11
|
+
*/
|
|
12
|
+
export declare function processTemplateOrHtmlContent(context: IExecuteSingleFunctions, includeSubject?: boolean): {
|
|
13
|
+
template?: any;
|
|
14
|
+
html?: string;
|
|
15
|
+
text?: string;
|
|
16
|
+
subject?: string;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=requestBuilders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestBuilders.d.ts","sourceRoot":"","sources":["../../../../nodes/Resend/utils/requestBuilders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAe,MAAM,cAAc,CAAC;AAIzF;;GAEG;AACH,wBAAsB,uBAAuB,CAC5C,IAAI,EAAE,uBAAuB,EAC7B,cAAc,EAAE,mBAAmB,GACjC,OAAO,CAAC,mBAAmB,CAAC,CAkB9B;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,OAAO,EAAE,uBAAuB,EAChC,cAAc,GAAE,OAAe,GAC7B;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CA0BpE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processTemplateOrHtmlContent = exports.preparePaginatedRequest = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const templateHelpers_1 = require("./templateHelpers");
|
|
6
|
+
/**
|
|
7
|
+
* Shared preSend hook for pagination across all resources
|
|
8
|
+
*/
|
|
9
|
+
async function preparePaginatedRequest(requestOptions) {
|
|
10
|
+
const qs = {};
|
|
11
|
+
const limit = this.getNodeParameter('limit', constants_1.PAGINATION.DEFAULT_LIMIT);
|
|
12
|
+
qs.limit = limit;
|
|
13
|
+
const after = this.getNodeParameter('after', '');
|
|
14
|
+
if (after) {
|
|
15
|
+
qs.after = after;
|
|
16
|
+
}
|
|
17
|
+
const before = this.getNodeParameter('before', '');
|
|
18
|
+
if (before) {
|
|
19
|
+
qs.before = before;
|
|
20
|
+
}
|
|
21
|
+
requestOptions.qs = qs;
|
|
22
|
+
return requestOptions;
|
|
23
|
+
}
|
|
24
|
+
exports.preparePaginatedRequest = preparePaginatedRequest;
|
|
25
|
+
/**
|
|
26
|
+
* Process template or HTML content for emails and broadcasts
|
|
27
|
+
* @param context - The n8n execution context
|
|
28
|
+
* @param includeSubject - Whether to include subject field when not using template
|
|
29
|
+
* @returns Object with template or html/text/subject fields
|
|
30
|
+
*/
|
|
31
|
+
function processTemplateOrHtmlContent(context, includeSubject = false) {
|
|
32
|
+
const result = {};
|
|
33
|
+
const useTemplate = context.getNodeParameter('useTemplate', false);
|
|
34
|
+
if (useTemplate) {
|
|
35
|
+
const templateId = context.getNodeParameter('templateId', '');
|
|
36
|
+
const templateVariables = context.getNodeParameter('templateVariables', {});
|
|
37
|
+
result.template = {
|
|
38
|
+
id: templateId,
|
|
39
|
+
variables: (0, templateHelpers_1.processTemplateVariables)(templateVariables),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
if (includeSubject) {
|
|
44
|
+
result.subject = context.getNodeParameter('subject', '');
|
|
45
|
+
}
|
|
46
|
+
result.html = context.getNodeParameter('html', '');
|
|
47
|
+
const text = context.getNodeParameter('text', '');
|
|
48
|
+
if (text) {
|
|
49
|
+
result.text = text;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
exports.processTemplateOrHtmlContent = processTemplateOrHtmlContent;
|
|
55
|
+
//# sourceMappingURL=requestBuilders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestBuilders.js","sourceRoot":"","sources":["../../../../nodes/Resend/utils/requestBuilders.ts"],"names":[],"mappings":";;;AACA,4CAA0C;AAC1C,uDAA6D;AAE7D;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAE5C,cAAmC;IAEnC,MAAM,EAAE,GAAgB,EAAE,CAAC;IAE3B,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,sBAAU,CAAC,aAAa,CAAW,CAAC;IACjF,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC;IAEjB,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,CAAW,CAAC;IAC3D,IAAI,KAAK,EAAE,CAAC;QACX,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAW,CAAC;IAC7D,IAAI,MAAM,EAAE,CAAC;QACZ,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC;IAED,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC;IACvB,OAAO,cAAc,CAAC;AACvB,CAAC;AArBD,0DAqBC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CAC3C,OAAgC,EAChC,iBAA0B,KAAK;IAE/B,MAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,KAAK,CAAY,CAAC;IAE9E,IAAI,WAAW,EAAE,CAAC;QACjB,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,YAAY,EAAE,EAAE,CAAW,CAAC;QACxE,MAAM,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,EAAE,CAAQ,CAAC;QAEnF,MAAM,CAAC,QAAQ,GAAG;YACjB,EAAE,EAAE,UAAU;YACd,SAAS,EAAE,IAAA,0CAAwB,EAAC,iBAAiB,CAAC;SACtD,CAAC;IACH,CAAC;SAAM,CAAC;QACP,IAAI,cAAc,EAAE,CAAC;YACpB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,EAAE,CAAW,CAAC;QACpE,CAAC;QACD,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,EAAE,CAAW,CAAC;QAE7D,MAAM,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,EAAE,CAAW,CAAC;QAC5D,IAAI,IAAI,EAAE,CAAC;YACV,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACpB,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AA7BD,oEA6BC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert template variables from fixedCollection to API format
|
|
3
|
+
* Auto-detects numbers and converts them appropriately
|
|
4
|
+
*/
|
|
5
|
+
export declare function processTemplateVariables(variablesData: any): Record<string, string | number>;
|
|
6
|
+
/**
|
|
7
|
+
* Convert fixedCollection tags to API format
|
|
8
|
+
*/
|
|
9
|
+
export declare function processEmailTags(tagsData: any): Array<{
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}> | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Convert contact properties from fixedCollection to API format
|
|
15
|
+
*/
|
|
16
|
+
export declare function processContactProperties(propertiesData: any): Record<string, string | number> | undefined;
|
|
17
|
+
//# sourceMappingURL=templateHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateHelpers.d.ts","sourceRoot":"","sources":["../../../../nodes/Resend/utils/templateHelpers.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAiB5F;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,GAAG,GACX,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CAapD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACvC,cAAc,EAAE,GAAG,GACjB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS,CAoB7C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processContactProperties = exports.processEmailTags = exports.processTemplateVariables = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Convert template variables from fixedCollection to API format
|
|
6
|
+
* Auto-detects numbers and converts them appropriately
|
|
7
|
+
*/
|
|
8
|
+
function processTemplateVariables(variablesData) {
|
|
9
|
+
if (!variablesData?.variable?.length) {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
const variables = {};
|
|
13
|
+
for (const variable of variablesData.variable) {
|
|
14
|
+
if (variable.key && variable.value !== undefined) {
|
|
15
|
+
// Try to parse as number if possible
|
|
16
|
+
const numValue = Number(variable.value);
|
|
17
|
+
variables[variable.key] =
|
|
18
|
+
isNaN(numValue) || variable.value === '' ? variable.value : numValue;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return variables;
|
|
22
|
+
}
|
|
23
|
+
exports.processTemplateVariables = processTemplateVariables;
|
|
24
|
+
/**
|
|
25
|
+
* Convert fixedCollection tags to API format
|
|
26
|
+
*/
|
|
27
|
+
function processEmailTags(tagsData) {
|
|
28
|
+
if (!tagsData?.tag?.length) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const tags = tagsData.tag
|
|
32
|
+
.filter((tag) => tag.name && tag.value !== undefined)
|
|
33
|
+
.map((tag) => ({
|
|
34
|
+
name: tag.name,
|
|
35
|
+
value: tag.value,
|
|
36
|
+
}));
|
|
37
|
+
return tags.length > 0 ? tags : undefined;
|
|
38
|
+
}
|
|
39
|
+
exports.processEmailTags = processEmailTags;
|
|
40
|
+
/**
|
|
41
|
+
* Convert contact properties from fixedCollection to API format
|
|
42
|
+
*/
|
|
43
|
+
function processContactProperties(propertiesData) {
|
|
44
|
+
if (!propertiesData?.property?.length) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const properties = {};
|
|
48
|
+
for (const prop of propertiesData.property) {
|
|
49
|
+
if (prop.key && prop.value !== undefined) {
|
|
50
|
+
// Convert based on type
|
|
51
|
+
if (prop.type === 'number') {
|
|
52
|
+
const numValue = Number(prop.value);
|
|
53
|
+
properties[prop.key] = isNaN(numValue) ? prop.value : numValue;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
properties[prop.key] = prop.value;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return Object.keys(properties).length > 0 ? properties : undefined;
|
|
61
|
+
}
|
|
62
|
+
exports.processContactProperties = processContactProperties;
|
|
63
|
+
//# sourceMappingURL=templateHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateHelpers.js","sourceRoot":"","sources":["../../../../nodes/Resend/utils/templateHelpers.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,aAAkB;IAC1D,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,SAAS,GAAoC,EAAE,CAAC;IAEtD,KAAK,MAAM,QAAQ,IAAI,aAAa,CAAC,QAAQ,EAA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