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,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.templatesResource = void 0;
|
|
4
|
+
const commonFields_1 = require("../utils/commonFields");
|
|
5
|
+
const requestBuilders_1 = require("../utils/requestBuilders");
|
|
6
|
+
exports.templatesResource = {
|
|
7
|
+
description: {
|
|
8
|
+
displayName: 'Template',
|
|
9
|
+
value: 'templates',
|
|
10
|
+
description: 'Manage email templates',
|
|
11
|
+
},
|
|
12
|
+
operations: [
|
|
13
|
+
{
|
|
14
|
+
name: 'List',
|
|
15
|
+
value: 'list',
|
|
16
|
+
description: 'List all templates',
|
|
17
|
+
action: 'List templates',
|
|
18
|
+
routing: {
|
|
19
|
+
request: {
|
|
20
|
+
method: 'GET',
|
|
21
|
+
url: '/templates',
|
|
22
|
+
},
|
|
23
|
+
send: {
|
|
24
|
+
preSend: [requestBuilders_1.preparePaginatedRequest],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Get',
|
|
30
|
+
value: 'get',
|
|
31
|
+
description: 'Get a template by ID or alias',
|
|
32
|
+
action: 'Get a template',
|
|
33
|
+
routing: {
|
|
34
|
+
request: {
|
|
35
|
+
method: 'GET',
|
|
36
|
+
url: '=/templates/{{$parameter.id}}',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
fields: [
|
|
42
|
+
// ================== LIST TEMPLATES FIELDS ==================
|
|
43
|
+
...(0, commonFields_1.buildPaginationFields)('templates', 'list'),
|
|
44
|
+
// ================== GET TEMPLATE FIELDS ==================
|
|
45
|
+
(0, commonFields_1.buildIdField)('templates', ['get'], 'Template ID or Alias', 'The ID or alias of the template'),
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../../nodes/Resend/resources/templates.ts"],"names":[],"mappings":";;;AAEA,wDAA4E;AAC5E,8DAAmE;AAEtD,QAAA,iBAAiB,GAAyB;IACtD,WAAW,EAAE;QACZ,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,wBAAwB;KACrC;IAED,UAAU,EAAE;QACX;YACC,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,oBAAoB;YACjC,MAAM,EAAE,gBAAgB;YACxB,OAAO,EAAE;gBACR,OAAO,EAAE;oBACR,MAAM,EAAE,KAAK;oBACb,GAAG,EAAE,YAAY;iBACjB;gBACD,IAAI,EAAE;oBACL,OAAO,EAAE,CAAC,yCAAuB,CAAC;iBAClC;aACD;SACD;QACD;YACC,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,+BAA+B;YAC5C,MAAM,EAAE,gBAAgB;YACxB,OAAO,EAAE;gBACR,OAAO,EAAE;oBACR,MAAM,EAAE,KAAK;oBACb,GAAG,EAAE,+BAA+B;iBACpC;aACD;SACD;KACD;IAED,MAAM,EAAE;QACP,8DAA8D;QAC9D,GAAG,IAAA,oCAAqB,EAAC,WAAW,EAAE,MAAM,CAAC;QAE7C,4DAA4D;QAC5D,IAAA,2BAAY,EAAC,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,sBAAsB,EAAE,iCAAiC,CAAC;KAC7F;CACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topics.d.ts","sourceRoot":"","sources":["../../../../nodes/Resend/resources/topics.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AA2DhD,eAAO,MAAM,cAAc,EAAE,oBAwK5B,CAAC"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.topicsResource = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const commonFields_1 = require("../utils/commonFields");
|
|
6
|
+
const requestBuilders_1 = require("../utils/requestBuilders");
|
|
7
|
+
// preSend hook for Create Topic
|
|
8
|
+
async function prepareCreateTopicRequest(requestOptions) {
|
|
9
|
+
const body = {
|
|
10
|
+
name: this.getNodeParameter('name', ''),
|
|
11
|
+
default_subscription: this.getNodeParameter('defaultSubscription', 'opt_in'),
|
|
12
|
+
};
|
|
13
|
+
const description = this.getNodeParameter('description', '');
|
|
14
|
+
if (description) {
|
|
15
|
+
body.description = description;
|
|
16
|
+
}
|
|
17
|
+
const visibility = this.getNodeParameter('visibility', 'public');
|
|
18
|
+
if (visibility) {
|
|
19
|
+
body.visibility = visibility;
|
|
20
|
+
}
|
|
21
|
+
// Validation
|
|
22
|
+
if (!body.name) {
|
|
23
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Topic name is required');
|
|
24
|
+
}
|
|
25
|
+
requestOptions.body = body;
|
|
26
|
+
return requestOptions;
|
|
27
|
+
}
|
|
28
|
+
// preSend hook for Update Topic
|
|
29
|
+
async function prepareUpdateTopicRequest(requestOptions) {
|
|
30
|
+
const body = {};
|
|
31
|
+
const name = this.getNodeParameter('name', '');
|
|
32
|
+
if (name) {
|
|
33
|
+
body.name = name;
|
|
34
|
+
}
|
|
35
|
+
const description = this.getNodeParameter('description', '');
|
|
36
|
+
if (description) {
|
|
37
|
+
body.description = description;
|
|
38
|
+
}
|
|
39
|
+
const visibility = this.getNodeParameter('visibility', '');
|
|
40
|
+
if (visibility) {
|
|
41
|
+
body.visibility = visibility;
|
|
42
|
+
}
|
|
43
|
+
requestOptions.body = body;
|
|
44
|
+
return requestOptions;
|
|
45
|
+
}
|
|
46
|
+
exports.topicsResource = {
|
|
47
|
+
description: {
|
|
48
|
+
displayName: 'Topic',
|
|
49
|
+
value: 'topics',
|
|
50
|
+
description: 'Manage topics for email preferences',
|
|
51
|
+
},
|
|
52
|
+
operations: [
|
|
53
|
+
{
|
|
54
|
+
name: 'Create',
|
|
55
|
+
value: 'create',
|
|
56
|
+
description: 'Create a new topic',
|
|
57
|
+
action: 'Create a topic',
|
|
58
|
+
routing: {
|
|
59
|
+
request: {
|
|
60
|
+
method: 'POST',
|
|
61
|
+
url: '/topics',
|
|
62
|
+
},
|
|
63
|
+
send: {
|
|
64
|
+
preSend: [prepareCreateTopicRequest],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'List',
|
|
70
|
+
value: 'list',
|
|
71
|
+
description: 'List all topics',
|
|
72
|
+
action: 'List topics',
|
|
73
|
+
routing: {
|
|
74
|
+
request: {
|
|
75
|
+
method: 'GET',
|
|
76
|
+
url: '/topics',
|
|
77
|
+
},
|
|
78
|
+
send: {
|
|
79
|
+
preSend: [requestBuilders_1.preparePaginatedRequest],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'Get',
|
|
85
|
+
value: 'get',
|
|
86
|
+
description: 'Get a topic by ID',
|
|
87
|
+
action: 'Get a topic',
|
|
88
|
+
routing: {
|
|
89
|
+
request: {
|
|
90
|
+
method: 'GET',
|
|
91
|
+
url: '=/topics/{{$parameter.id}}',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'Update',
|
|
97
|
+
value: 'update',
|
|
98
|
+
description: 'Update a topic',
|
|
99
|
+
action: 'Update a topic',
|
|
100
|
+
routing: {
|
|
101
|
+
request: {
|
|
102
|
+
method: 'PATCH',
|
|
103
|
+
url: '=/topics/{{$parameter.id}}',
|
|
104
|
+
},
|
|
105
|
+
send: {
|
|
106
|
+
preSend: [prepareUpdateTopicRequest],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'Delete',
|
|
112
|
+
value: 'delete',
|
|
113
|
+
description: 'Delete a topic',
|
|
114
|
+
action: 'Delete a topic',
|
|
115
|
+
routing: {
|
|
116
|
+
request: {
|
|
117
|
+
method: 'DELETE',
|
|
118
|
+
url: '=/topics/{{$parameter.id}}',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
fields: [
|
|
124
|
+
// ================== CREATE TOPIC FIELDS ==================
|
|
125
|
+
{
|
|
126
|
+
displayName: 'Name',
|
|
127
|
+
name: 'name',
|
|
128
|
+
type: 'string',
|
|
129
|
+
required: true,
|
|
130
|
+
default: '',
|
|
131
|
+
displayOptions: {
|
|
132
|
+
show: {
|
|
133
|
+
resource: ['topics'],
|
|
134
|
+
operation: ['create', 'update'],
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
description: 'Topic name (max 50 characters)',
|
|
138
|
+
placeholder: 'Weekly Newsletter',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
displayName: 'Default Subscription',
|
|
142
|
+
name: 'defaultSubscription',
|
|
143
|
+
type: 'options',
|
|
144
|
+
options: [
|
|
145
|
+
{
|
|
146
|
+
name: 'Opt-In',
|
|
147
|
+
value: 'opt_in',
|
|
148
|
+
description: 'Contacts are subscribed by default',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: 'Opt-Out',
|
|
152
|
+
value: 'opt_out',
|
|
153
|
+
description: 'Contacts must explicitly subscribe',
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
default: 'opt_in',
|
|
157
|
+
displayOptions: {
|
|
158
|
+
show: {
|
|
159
|
+
resource: ['topics'],
|
|
160
|
+
operation: ['create'],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
description: 'Default subscription preference for new contacts. Cannot be changed after creation.',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
displayName: 'Description',
|
|
167
|
+
name: 'description',
|
|
168
|
+
type: 'string',
|
|
169
|
+
default: '',
|
|
170
|
+
displayOptions: {
|
|
171
|
+
show: {
|
|
172
|
+
resource: ['topics'],
|
|
173
|
+
operation: ['create', 'update'],
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
description: 'Topic description (max 200 characters, optional)',
|
|
177
|
+
placeholder: 'Subscribe to our weekly newsletter for updates',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
displayName: 'Visibility',
|
|
181
|
+
name: 'visibility',
|
|
182
|
+
type: 'options',
|
|
183
|
+
options: [
|
|
184
|
+
{
|
|
185
|
+
name: 'Public',
|
|
186
|
+
value: 'public',
|
|
187
|
+
description: 'All contacts can see this topic on the unsubscribe page',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'Private',
|
|
191
|
+
value: 'private',
|
|
192
|
+
description: 'Only contacts opted-in can see this topic on the unsubscribe page',
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
default: 'public',
|
|
196
|
+
displayOptions: {
|
|
197
|
+
show: {
|
|
198
|
+
resource: ['topics'],
|
|
199
|
+
operation: ['create', 'update'],
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
description: 'Visibility of the topic on the unsubscribe page',
|
|
203
|
+
},
|
|
204
|
+
// ================== GET/UPDATE/DELETE TOPIC FIELDS ==================
|
|
205
|
+
(0, commonFields_1.buildIdField)('topics', ['get', 'update', 'delete'], 'Topic ID', 'The ID of the topic'),
|
|
206
|
+
// ================== LIST TOPICS FIELDS ==================
|
|
207
|
+
...(0, commonFields_1.buildPaginationFields)('topics', 'list'),
|
|
208
|
+
],
|
|
209
|
+
};
|
|
210
|
+
//# sourceMappingURL=topics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topics.js","sourceRoot":"","sources":["../../../../nodes/Resend/resources/topics.ts"],"names":[],"mappings":";;;AAAA,+CAKsB;AAEtB,wDAA4E;AAC5E,8DAAmE;AAEnE,gCAAgC;AAChC,KAAK,UAAU,yBAAyB,CAEvC,cAAmC;IAEnC,MAAM,IAAI,GAAQ;QACjB,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,EAAE,CAAW;QACjD,oBAAoB,EAAE,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,QAAQ,CAAW;KACtF,CAAC;IAEF,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,EAAE,CAAW,CAAC;IACvE,IAAI,WAAW,EAAE,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAW,CAAC;IAC3E,IAAI,UAAU,EAAE,CAAC;QAChB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;IAED,aAAa;IACb,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,w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;YACD,WAAW,EAAE,iDAAiD;SAC9D;QAED,uEAAuE;QACvE,IAAA,2BAAY,EAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,UAAU,EAAE,qBAAqB,CAAC;QAEtF,2DAA2D;QAC3D,GAAG,IAAA,oCAAqB,EAAC,QAAQ,EAAE,MAAM,CAAC;KAC1C;CACD,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export type ResendResource = 'emails' | 'contacts' | 'segments' | 'broadcasts' | 'topics' | 'templates';
|
|
3
|
+
export type EmailOperation = 'send' | 'sendBatch' | 'list' | 'get' | 'cancel' | 'update';
|
|
4
|
+
export type ContactOperation = 'create' | 'list' | 'get' | 'update' | 'delete' | 'addToSegment' | 'removeFromSegment';
|
|
5
|
+
export type SegmentOperation = 'create' | 'list' | 'get' | 'update' | 'delete';
|
|
6
|
+
export type BroadcastOperation = 'create' | 'list' | 'get' | 'update' | 'send' | 'delete';
|
|
7
|
+
export type TopicOperation = 'create' | 'list' | 'get' | 'update' | 'delete';
|
|
8
|
+
export type TemplateOperation = 'list' | 'get';
|
|
9
|
+
export interface ResendAttachment {
|
|
10
|
+
filename?: string;
|
|
11
|
+
content?: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
content_type?: string;
|
|
14
|
+
content_id?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface TemplateVariable {
|
|
17
|
+
key: string;
|
|
18
|
+
value: string | number;
|
|
19
|
+
}
|
|
20
|
+
export interface EmailTag {
|
|
21
|
+
name: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}
|
|
24
|
+
export interface EmailHeader {
|
|
25
|
+
key: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ContactProperty {
|
|
29
|
+
key: string;
|
|
30
|
+
value: string | number;
|
|
31
|
+
type?: 'string' | 'number';
|
|
32
|
+
}
|
|
33
|
+
export interface PaginatedResponse<T> {
|
|
34
|
+
object: 'list';
|
|
35
|
+
data: T[];
|
|
36
|
+
has_more: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface Domain {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
status: string;
|
|
42
|
+
created_at: string;
|
|
43
|
+
region: string;
|
|
44
|
+
}
|
|
45
|
+
export interface Segment {
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
created_at: string;
|
|
50
|
+
}
|
|
51
|
+
export interface Topic {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
default_subscription: 'opt_in' | 'opt_out';
|
|
56
|
+
visibility: 'public' | 'private';
|
|
57
|
+
created_at: string;
|
|
58
|
+
}
|
|
59
|
+
export interface Template {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
alias?: string;
|
|
63
|
+
subject?: string;
|
|
64
|
+
from?: string;
|
|
65
|
+
html?: string;
|
|
66
|
+
status?: string;
|
|
67
|
+
variables?: Array<{
|
|
68
|
+
key: string;
|
|
69
|
+
type: 'string' | 'number';
|
|
70
|
+
fallback_value?: string | number;
|
|
71
|
+
}>;
|
|
72
|
+
created_at: string;
|
|
73
|
+
}
|
|
74
|
+
export interface SendEmailRequestBody {
|
|
75
|
+
from: string;
|
|
76
|
+
to: string[];
|
|
77
|
+
subject?: string;
|
|
78
|
+
html?: string;
|
|
79
|
+
text?: string;
|
|
80
|
+
cc?: string[];
|
|
81
|
+
bcc?: string[];
|
|
82
|
+
reply_to?: string[];
|
|
83
|
+
template?: {
|
|
84
|
+
id: string;
|
|
85
|
+
variables: Record<string, string | number>;
|
|
86
|
+
};
|
|
87
|
+
topic_id?: string;
|
|
88
|
+
attachments?: ResendAttachment[];
|
|
89
|
+
headers?: Record<string, string>;
|
|
90
|
+
tags?: EmailTag[];
|
|
91
|
+
scheduled_at?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface BroadcastRequestBody {
|
|
94
|
+
segment_id?: string;
|
|
95
|
+
from: string;
|
|
96
|
+
subject: string;
|
|
97
|
+
name?: string;
|
|
98
|
+
html?: string;
|
|
99
|
+
text?: string;
|
|
100
|
+
template?: {
|
|
101
|
+
id: string;
|
|
102
|
+
variables: Record<string, string | number>;
|
|
103
|
+
};
|
|
104
|
+
topic_id?: string;
|
|
105
|
+
reply_to?: string[];
|
|
106
|
+
}
|
|
107
|
+
export interface ContactRequestBody {
|
|
108
|
+
email?: string;
|
|
109
|
+
first_name?: string;
|
|
110
|
+
last_name?: string;
|
|
111
|
+
unsubscribed?: boolean;
|
|
112
|
+
properties?: Record<string, string | number>;
|
|
113
|
+
}
|
|
114
|
+
export interface SegmentRequestBody {
|
|
115
|
+
name: string;
|
|
116
|
+
description?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface TopicRequestBody {
|
|
119
|
+
name?: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
default_subscription?: 'opt_in' | 'opt_out';
|
|
122
|
+
visibility?: 'public' | 'private';
|
|
123
|
+
}
|
|
124
|
+
export interface PaginationQuery {
|
|
125
|
+
limit?: number;
|
|
126
|
+
after?: string;
|
|
127
|
+
before?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface ResendResourceDescription {
|
|
130
|
+
displayName: string;
|
|
131
|
+
value: ResendResource;
|
|
132
|
+
description: string;
|
|
133
|
+
}
|
|
134
|
+
export interface ResendOperationDescription {
|
|
135
|
+
name: string;
|
|
136
|
+
value: string;
|
|
137
|
+
description: string;
|
|
138
|
+
action: string;
|
|
139
|
+
routing?: any;
|
|
140
|
+
}
|
|
141
|
+
export interface ResendResourceModule {
|
|
142
|
+
description: ResendResourceDescription;
|
|
143
|
+
operations: ResendOperationDescription[];
|
|
144
|
+
fields: INodeProperties[];
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../nodes/Resend/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IExecuteSingleFunctions } from 'n8n-workflow';
|
|
2
|
+
import { ResendAttachment } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Process attachments from fixedCollection format to Resend API format
|
|
5
|
+
*/
|
|
6
|
+
export declare function processAttachments(this: IExecuteSingleFunctions, attachmentsData: any): Promise<ResendAttachment[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Split email string into array of email addresses
|
|
9
|
+
*/
|
|
10
|
+
export declare function splitEmails(emailString: string): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Convert fixedCollection key-value pairs to object
|
|
13
|
+
*/
|
|
14
|
+
export declare function keyValuePairsToObject(data: any, itemName?: string): Record<string, string> | undefined;
|
|
15
|
+
//# sourceMappingURL=attachmentHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentHelpers.d.ts","sourceRoot":"","sources":["../../../../nodes/Resend/utils/attachmentHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAsB,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5C;;GAEG;AACH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,uBAAuB,EAC7B,eAAe,EAAE,GAAG,GAClB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAoE7B;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CASzD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,GAAG,EACT,QAAQ,GAAE,MAAe,GACvB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAapC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyValuePairsToObject = exports.splitEmails = exports.processAttachments = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
/**
|
|
7
|
+
* Process attachments from fixedCollection format to Resend API format
|
|
8
|
+
*/
|
|
9
|
+
async function processAttachments(attachmentsData) {
|
|
10
|
+
if (!attachmentsData?.attachment?.length) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const attachments = [];
|
|
14
|
+
let totalSize = 0;
|
|
15
|
+
const MAX_SIZE = constants_1.ATTACHMENT.MAX_SIZE_BYTES;
|
|
16
|
+
for (const attachment of attachmentsData.attachment) {
|
|
17
|
+
const processedAttachment = {};
|
|
18
|
+
// Handle binary property
|
|
19
|
+
if (attachment.binaryPropertyName) {
|
|
20
|
+
try {
|
|
21
|
+
const binaryData = this.getInputData().binary?.[attachment.binaryPropertyName];
|
|
22
|
+
if (binaryData) {
|
|
23
|
+
// Convert binary data to base64
|
|
24
|
+
const buffer = await this.helpers.getBinaryDataBuffer(attachment.binaryPropertyName);
|
|
25
|
+
processedAttachment.content = buffer.toString('base64');
|
|
26
|
+
totalSize += buffer.length;
|
|
27
|
+
// Set filename
|
|
28
|
+
processedAttachment.filename = attachment.filename || binaryData.fileName || 'file';
|
|
29
|
+
// Set content type
|
|
30
|
+
if (attachment.contentType) {
|
|
31
|
+
processedAttachment.content_type = attachment.contentType;
|
|
32
|
+
}
|
|
33
|
+
else if (binaryData.mimeType) {
|
|
34
|
+
processedAttachment.content_type = binaryData.mimeType;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Error reading binary data from property "${attachment.binaryPropertyName}": ${error.message}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Handle inline images (CID)
|
|
43
|
+
if (attachment.contentId) {
|
|
44
|
+
processedAttachment.content_id = attachment.contentId;
|
|
45
|
+
}
|
|
46
|
+
// Add filename if provided and not already set
|
|
47
|
+
if (attachment.filename && !processedAttachment.filename) {
|
|
48
|
+
processedAttachment.filename = attachment.filename;
|
|
49
|
+
}
|
|
50
|
+
// Only add if we have content
|
|
51
|
+
if (processedAttachment.content) {
|
|
52
|
+
// Validate total size
|
|
53
|
+
if (totalSize > MAX_SIZE) {
|
|
54
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Total attachment size (${(totalSize / 1024 / 1024).toFixed(2)}MB) exceeds the ${constants_1.ATTACHMENT.MAX_SIZE_MB}MB limit`);
|
|
55
|
+
}
|
|
56
|
+
attachments.push(processedAttachment);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return attachments;
|
|
60
|
+
}
|
|
61
|
+
exports.processAttachments = processAttachments;
|
|
62
|
+
/**
|
|
63
|
+
* Split email string into array of email addresses
|
|
64
|
+
*/
|
|
65
|
+
function splitEmails(emailString) {
|
|
66
|
+
if (!emailString || emailString.trim() === '') {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
return emailString
|
|
70
|
+
.split(',')
|
|
71
|
+
.map((email) => email.trim())
|
|
72
|
+
.filter((email) => email.length > 0);
|
|
73
|
+
}
|
|
74
|
+
exports.splitEmails = splitEmails;
|
|
75
|
+
/**
|
|
76
|
+
* Convert fixedCollection key-value pairs to object
|
|
77
|
+
*/
|
|
78
|
+
function keyValuePairsToObject(data, itemName = 'pair') {
|
|
79
|
+
if (!data?.[itemName]?.length) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
const result = {};
|
|
83
|
+
for (const item of data[itemName]) {
|
|
84
|
+
if (item.key && item.value !== undefined) {
|
|
85
|
+
result[item.key] = item.value;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
89
|
+
}
|
|
90
|
+
exports.keyValuePairsToObject = keyValuePairsToObject;
|
|
91
|
+
//# sourceMappingURL=attachmentHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentHelpers.js","sourceRoot":"","sources":["../../../../nodes/Resend/utils/attachmentHelpers.ts"],"names":[],"mappings":";;;AAAA,+CAA2E;AAE3E,4CAA0C;AAE1C;;GAEG;AACI,KAAK,UAAU,kBAAkB,CAEvC,eAAoB;IAEpB,IAAI,CAAC,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAC1C,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,WAAW,GAAuB,EAAE,CAAC;IAC3C,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,MAAM,QAAQ,GAAG,sBAAU,CAAC,cAAc,CAAC;IAE3C,KAAK,MAAM,UAAU,IAAI,eAAe,CAAC,UAAU,EAAE,CAAC;QACrD,MAAM,mBAAmB,GAAqB,EAAE,CAAC;QAEjD,yBAAyB;QACzB,IAAI,UAAU,CAAC,kBAAkB,EAAE,CAAC;YACnC,IAAI,CAAC;gBACJ,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;gBAE/E,IAAI,UAAU,EAAE,CAAC;oBAChB,gCAAgC;oBAChC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;oBACrF,mBAAmB,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;oBACxD,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC;oBAE3B,eAAe;oBACf,mBAAmB,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,IAAI,UAAU,CAAC,QAAQ,IAAI,MAAM,CAAC;oBAEpF,mBAAmB;oBACnB,IAAI,UAAU,CAAC,WAAW,EAA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AAE,KAAK,EAAE,EAAE,CAAC;QAC/C,OAAO,EAAE,CAAC;IACX,CAAC;IAED,OAAO,WAAW;SAChB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AATD,kCASC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CACpC,IAAS,EACT,WAAmB,MAAM;IAEzB,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC1C,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAC/B,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5D,CAAC;AAhBD,sDAgBC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { ResendResource } from '../types';
|
|
3
|
+
export declare function buildResourceField(resources: {
|
|
4
|
+
name: string;
|
|
5
|
+
value: ResendResource;
|
|
6
|
+
}[]): INodeProperties;
|
|
7
|
+
export declare function buildIdField(resource: ResendResource, operations: string[], displayName?: string, description?: string): INodeProperties;
|
|
8
|
+
export declare function buildPaginationFields(resource: ResendResource, operation: string): INodeProperties[];
|
|
9
|
+
//# sourceMappingURL=commonFields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonFields.d.ts","sourceRoot":"","sources":["../../../../nodes/Resend/utils/commonFields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,wBAAgB,kBAAkB,CACjC,SAAS,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,EAAE,GAClD,eAAe,CAUjB;AAED,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,GAAE,MAAa,EAC1B,WAAW,GAAE,MAAiC,GAC5C,eAAe,CAejB;AAED,wBAAgB,qBAAqB,CACpC,QAAQ,EAAE,cAAc,EACxB,SAAS,EAAE,MAAM,GACf,eAAe,EAAE,CA8CnB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPaginationFields = exports.buildIdField = exports.buildResourceField = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
function buildResourceField(resources) {
|
|
6
|
+
return {
|
|
7
|
+
displayName: 'Resource',
|
|
8
|
+
name: 'resource',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
options: resources,
|
|
12
|
+
default: 'emails',
|
|
13
|
+
description: 'The resource to operate on',
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.buildResourceField = buildResourceField;
|
|
17
|
+
function buildIdField(resource, operations, displayName = 'ID', description = 'The ID of the resource') {
|
|
18
|
+
return {
|
|
19
|
+
displayName,
|
|
20
|
+
name: 'id',
|
|
21
|
+
type: 'string',
|
|
22
|
+
required: true,
|
|
23
|
+
default: '',
|
|
24
|
+
displayOptions: {
|
|
25
|
+
show: {
|
|
26
|
+
resource: [resource],
|
|
27
|
+
operation: operations,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
description,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
exports.buildIdField = buildIdField;
|
|
34
|
+
function buildPaginationFields(resource, operation) {
|
|
35
|
+
return [
|
|
36
|
+
{
|
|
37
|
+
displayName: 'Limit',
|
|
38
|
+
name: 'limit',
|
|
39
|
+
type: 'number',
|
|
40
|
+
default: constants_1.PAGINATION.DEFAULT_LIMIT,
|
|
41
|
+
typeOptions: {
|
|
42
|
+
minValue: 1,
|
|
43
|
+
maxValue: constants_1.PAGINATION.MAX_LIMIT,
|
|
44
|
+
},
|
|
45
|
+
displayOptions: {
|
|
46
|
+
show: {
|
|
47
|
+
resource: [resource],
|
|
48
|
+
operation: [operation],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
description: `Maximum number of results to return (1-${constants_1.PAGINATION.MAX_LIMIT})`,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
displayName: 'After',
|
|
55
|
+
name: 'after',
|
|
56
|
+
type: 'string',
|
|
57
|
+
default: '',
|
|
58
|
+
displayOptions: {
|
|
59
|
+
show: {
|
|
60
|
+
resource: [resource],
|
|
61
|
+
operation: [operation],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
description: 'Cursor for forward pagination (ID of last item from previous page)',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Before',
|
|
68
|
+
name: 'before',
|
|
69
|
+
type: 'string',
|
|
70
|
+
default: '',
|
|
71
|
+
displayOptions: {
|
|
72
|
+
show: {
|
|
73
|
+
resource: [resource],
|
|
74
|
+
operation: [operation],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
description: 'Cursor for backward pagination (ID of first item from next page)',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
exports.buildPaginationFields = buildPaginationFields;
|
|
82
|
+
//# sourceMappingURL=commonFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonFields.js","sourceRoot":"","sources":["../../../../nodes/Resend/utils/commonFields.ts"],"names":[],"mappings":";;;AAEA,4CAA0C;AAE1C,SAAgB,kBAAkB,CACjC,SAAoD;IAEpD,OAAO;QACN,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,QAAQ;QACjB,WAAW,EAAE,4BAA4B;KACzC,CAAC;AACH,CAAC;AAZD,gDAYC;AAED,SAAgB,YAAY,CAC3B,QAAwB,EACxB,UAAoB,EACpB,cAAsB,IAAI,EAC1B,cAAsB,wBAAwB;IAE9C,OAAO;QACN,WAAW;QACX,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBACpB,SAAS,EAAE,UAAU;aACrB;SACD;QACD,WAAW;KACX,CAAC;AACH,CAAC;AApBD,oCAoBC;AAED,SAAgB,qBAAqB,CACpC,QAAwB,EACxB,SAAiB;IAEjB,OAAO;QACN;YACC,WAAW,EAAE,OAAO;YACpB,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,sBAAU,CAAC,aAAa;YACjC,WAAW,EAAE;gBACZ,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,sBAAU,CAAC,SAAS;aAC9B;YACD,cAAc,EAAE;gBACf,IAAI,EAAE;oBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;oBACpB,SAAS,EAAE,CAAC,SAAS,CAAC;iBACtB;aACD;YACD,WAAW,EAAE,0CAA0C,sBAAU,CAAC,SAAS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