n8n-nodes-corbit-sms 1.0.1 → 1.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 +19 -5
- package/dist/credentials/CorbitSmsApi.credentials.js +2 -1
- package/dist/credentials/CorbitSmsApi.credentials.js.map +1 -1
- package/dist/nodes/CorbitSms/CorbitSms.node.d.ts +4 -3
- package/dist/nodes/CorbitSms/CorbitSms.node.js +60 -24
- package/dist/nodes/CorbitSms/CorbitSms.node.js.map +1 -1
- package/dist/nodes/CorbitSms/CorbitSms.node.json +11 -2
- package/dist/nodes/CorbitSms/CorbitSmsDescription.js +30 -16
- package/dist/nodes/CorbitSms/CorbitSmsDescription.js.map +1 -1
- package/dist/nodes/CorbitSms/GenericFunctions.d.ts +3 -2
- package/dist/nodes/CorbitSms/GenericFunctions.js +39 -20
- package/dist/nodes/CorbitSms/GenericFunctions.js.map +1 -1
- package/dist/package.json +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ This is an n8n community node for [Corbit SMS](https://sms.corbit.sa), an SMS ga
|
|
|
8
8
|
- [Operations](#operations)
|
|
9
9
|
- [Credentials](#credentials)
|
|
10
10
|
- [Usage](#usage)
|
|
11
|
+
- [Example workflow](#example-workflow)
|
|
11
12
|
- [Compatibility](#compatibility)
|
|
12
13
|
- [Resources](#resources)
|
|
13
14
|
|
|
@@ -40,21 +41,34 @@ Keep **Base URL** as `https://api.corbit.sa` unless Corbit support gives you ano
|
|
|
40
41
|
|
|
41
42
|
## Usage
|
|
42
43
|
|
|
43
|
-
**Phone numbers.** Use the international format, for example `
|
|
44
|
+
**Phone numbers.** Use the international format, for example `966501234567`. Spaces, dashes, a leading `+` or `00` are removed. Saudi local numbers (`05XXXXXXXX`) are converted to `9665XXXXXXXX`. Local numbers of other countries (starting with `0`) are rejected, so nothing is sent to a wrong number: write them in international format.
|
|
44
45
|
|
|
45
|
-
**Sender name.**
|
|
46
|
+
**Sender name.** Open the list to pick one of your approved sender names (it loads when you open it), or switch to **By Name** and type the name. You can also use an expression.
|
|
46
47
|
|
|
47
|
-
**Send Bulk.** Enter the numbers separated by commas or new lines, or pass
|
|
48
|
+
**Send Bulk.** Enter the numbers separated by commas or new lines, or pass a list with an expression. Duplicates are removed. If any number is invalid, the node stops before sending, because Corbit SMS rejects the whole request.
|
|
48
49
|
|
|
49
50
|
**Message length.** Up to 1600 characters.
|
|
50
51
|
|
|
51
52
|
**Duplicate protection.** Corbit SMS blocks the same text to the same number within one hour. To send it again on purpose (for example an OTP resend), turn on **Allow Duplicate** under **Options**.
|
|
52
53
|
|
|
53
|
-
**Safe retries.** Set an **Idempotency Key** under **Options
|
|
54
|
+
**Safe retries.** Set an **Idempotency Key** under **Options**, with a different value for each message (for example `{{ $execution.id }}-{{ $json.orderId }}`). If the request is retried with the same key, Corbit SMS returns the first result and does not send again. Don't use one fixed key for many items.
|
|
54
55
|
|
|
55
56
|
**Rate limit.** 1000 requests per minute per token. If you hit it, turn on **Retry On Fail** in the node settings.
|
|
56
57
|
|
|
57
|
-
**Output.** Send returns `messageId`, `status`, `to` and `senderName`. Use `messageId` with Get Status or Get Delivery Report.
|
|
58
|
+
**Output.** Send returns `messageId`, `status`, `to` and `senderName`; Send Bulk also returns `numbers` and `recipients`. Use `messageId` with Get Status or Get Delivery Report. Get Delivery Report returns one item per recipient.
|
|
59
|
+
|
|
60
|
+
**AI agents.** The node can be used as a tool by the n8n AI Agent. Set **Sender Name** to a fixed value when you use it as a tool, so the agent doesn't have to guess it.
|
|
61
|
+
|
|
62
|
+
## Example workflow
|
|
63
|
+
|
|
64
|
+
[`examples/send-otp-and-check-delivery.json`](examples/send-otp-and-check-delivery.json) sends a one-time code and checks that it was delivered. Import it in n8n with **Workflow menu → Import from File**.
|
|
65
|
+
|
|
66
|
+
1. **Webhook** (POST `/send-otp`) receives `{ "phone": "966501234567", "code": "4821" }`.
|
|
67
|
+
2. **Corbit SMS → Send** sends `Your verification code is 4821` to the phone. **Allow Duplicate** is on, so a resend of the same code is not blocked, and the execution ID is the idempotency key, so a retry of the same execution never sends twice.
|
|
68
|
+
3. **Wait** 30 seconds.
|
|
69
|
+
4. **Corbit SMS → Get Status** reads the delivery status of the message.
|
|
70
|
+
|
|
71
|
+
Before you run it, choose your Corbit SMS credential in both Corbit SMS nodes and replace `YourSender` with one of your approved sender names.
|
|
58
72
|
|
|
59
73
|
## Compatibility
|
|
60
74
|
|
|
@@ -22,6 +22,7 @@ class CorbitSmsApi {
|
|
|
22
22
|
name: 'baseUrl',
|
|
23
23
|
type: 'string',
|
|
24
24
|
default: 'https://api.corbit.sa',
|
|
25
|
+
placeholder: 'https://api.corbit.sa',
|
|
25
26
|
description: 'Leave as it is unless Corbit support gives you another address',
|
|
26
27
|
},
|
|
27
28
|
];
|
|
@@ -35,7 +36,7 @@ class CorbitSmsApi {
|
|
|
35
36
|
};
|
|
36
37
|
this.test = {
|
|
37
38
|
request: {
|
|
38
|
-
baseURL: '={{$credentials.baseUrl.replace(/\\/+$/, "")}}',
|
|
39
|
+
baseURL: '={{($credentials.baseUrl || "https://api.corbit.sa").replace(/\\/+$/, "")}}',
|
|
39
40
|
url: '/api/v1/get-balance',
|
|
40
41
|
method: 'POST',
|
|
41
42
|
headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CorbitSmsApi.credentials.js","sourceRoot":"","sources":["../../credentials/CorbitSmsApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,YAAY;IAAzB;QACC,SAAI,GAAG,cAAc,CAAC;QAEtB,gBAAW,GAAG,gBAAgB,CAAC;QAE/B,SAAI,GAAS,EAAE,KAAK,EAAE,0BAA0B,EAAE,IAAI,EAAE,+BAA+B,EAAE,CAAC;QAE1F,qBAAgB,GAAG,2BAA2B,CAAC;QAE/C,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EACV,6DAA6D;aAC9D;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uBAAuB;gBAChC,WAAW,EAAE,gEAAgE;aAC7E;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,mCAAmC;iBAClD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CorbitSmsApi.credentials.js","sourceRoot":"","sources":["../../credentials/CorbitSmsApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,YAAY;IAAzB;QACC,SAAI,GAAG,cAAc,CAAC;QAEtB,gBAAW,GAAG,gBAAgB,CAAC;QAE/B,SAAI,GAAS,EAAE,KAAK,EAAE,0BAA0B,EAAE,IAAI,EAAE,+BAA+B,EAAE,CAAC;QAE1F,qBAAgB,GAAG,2BAA2B,CAAC;QAE/C,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EACV,6DAA6D;aAC9D;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uBAAuB;gBAChC,WAAW,EAAE,uBAAuB;gBACpC,WAAW,EAAE,gEAAgE;aAC7E;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,mCAAmC;iBAClD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,6EAA6E;gBACtF,GAAG,EAAE,qBAAqB;gBAC1B,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACR,MAAM,EAAE,kBAAkB;iBAC1B;aACD;SACD,CAAC;IACH,CAAC;CAAA;AAjDD,oCAiDC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData,
|
|
1
|
+
import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodeListSearchResult, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare function senderValue(raw: unknown): string;
|
|
2
3
|
export declare class CorbitSms implements INodeType {
|
|
3
4
|
description: INodeTypeDescription;
|
|
4
5
|
methods: {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
listSearch: {
|
|
7
|
+
searchSenderNames(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
7
8
|
};
|
|
8
9
|
};
|
|
9
10
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CorbitSms = void 0;
|
|
4
|
+
exports.senderValue = senderValue;
|
|
4
5
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
6
|
const GenericFunctions_1 = require("./GenericFunctions");
|
|
6
7
|
const CorbitSmsDescription_1 = require("./CorbitSmsDescription");
|
|
8
|
+
function senderValue(raw) {
|
|
9
|
+
var _a;
|
|
10
|
+
if (raw && typeof raw === 'object' && 'value' in raw) {
|
|
11
|
+
return String((_a = raw.value) !== null && _a !== void 0 ? _a : '').trim();
|
|
12
|
+
}
|
|
13
|
+
return raw === null || raw === undefined ? '' : String(raw).trim();
|
|
14
|
+
}
|
|
7
15
|
class CorbitSms {
|
|
8
16
|
constructor() {
|
|
9
17
|
this.description = {
|
|
@@ -29,19 +37,22 @@ class CorbitSms {
|
|
|
29
37
|
properties: CorbitSmsDescription_1.nodeProperties,
|
|
30
38
|
};
|
|
31
39
|
this.methods = {
|
|
32
|
-
|
|
33
|
-
async
|
|
40
|
+
listSearch: {
|
|
41
|
+
async searchSenderNames(filter) {
|
|
42
|
+
const wanted = (filter !== null && filter !== void 0 ? filter : '').trim().toLowerCase();
|
|
34
43
|
const senders = await GenericFunctions_1.getAllSenderNames.call(this);
|
|
35
|
-
|
|
44
|
+
const results = senders
|
|
36
45
|
.filter((s) => String(s.status).toLowerCase() === 'approved')
|
|
37
46
|
.map((s) => ({ name: String(s.name), value: String(s.name) }))
|
|
47
|
+
.filter((s) => wanted === '' || s.name.toLowerCase().includes(wanted))
|
|
38
48
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
49
|
+
return { results };
|
|
39
50
|
},
|
|
40
51
|
},
|
|
41
52
|
};
|
|
42
53
|
}
|
|
43
54
|
async execute() {
|
|
44
|
-
var _a, _b, _c, _d, _e, _f;
|
|
55
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
45
56
|
const items = this.getInputData();
|
|
46
57
|
const returnData = [];
|
|
47
58
|
const node = this.getNode();
|
|
@@ -50,23 +61,32 @@ class CorbitSms {
|
|
|
50
61
|
const resource = this.getNodeParameter('resource', i);
|
|
51
62
|
const operation = this.getNodeParameter('operation', i);
|
|
52
63
|
if (resource === 'sms' && (operation === 'send' || operation === 'sendBulk')) {
|
|
53
|
-
const senderName =
|
|
54
|
-
const message = this.getNodeParameter('message', i);
|
|
64
|
+
const senderName = senderValue(this.getNodeParameter('senderName', i));
|
|
55
65
|
const options = this.getNodeParameter('options', i, {});
|
|
56
66
|
if (senderName === '') {
|
|
57
|
-
throw new n8n_workflow_1.NodeOperationError(node,
|
|
67
|
+
throw new n8n_workflow_1.NodeOperationError(node, "Choose a value for 'Sender Name'", {
|
|
68
|
+
itemIndex: i,
|
|
69
|
+
});
|
|
58
70
|
}
|
|
59
|
-
(0, GenericFunctions_1.checkMessage)(node, message, i);
|
|
71
|
+
const message = (0, GenericFunctions_1.checkMessage)(node, this.getNodeParameter('message', i), i);
|
|
60
72
|
const headers = { 'Content-Type': 'application/json' };
|
|
61
|
-
if (options.idempotencyKey)
|
|
62
|
-
|
|
73
|
+
if (options.idempotencyKey !== undefined && String(options.idempotencyKey) !== '') {
|
|
74
|
+
const key = String(options.idempotencyKey);
|
|
75
|
+
if (key.length > GenericFunctions_1.MAX_IDEMPOTENCY_KEY_LENGTH) {
|
|
76
|
+
throw new n8n_workflow_1.NodeOperationError(node, `'Idempotency Key' is ${key.length} characters; the limit is ${GenericFunctions_1.MAX_IDEMPOTENCY_KEY_LENGTH}`, { itemIndex: i });
|
|
77
|
+
}
|
|
78
|
+
headers['Idempotency-Key'] = key;
|
|
79
|
+
}
|
|
63
80
|
if (options.allowDuplicate === true)
|
|
64
81
|
headers['X-Allow-Duplicate'] = 'true';
|
|
65
82
|
if (operation === 'send') {
|
|
66
83
|
const raw = this.getNodeParameter('to', i);
|
|
67
84
|
const number = (0, GenericFunctions_1.normalizeNumber)(raw);
|
|
68
85
|
if (!number) {
|
|
69
|
-
throw new n8n_workflow_1.NodeOperationError(node, `
|
|
86
|
+
throw new n8n_workflow_1.NodeOperationError(node, `'To' is not a valid mobile number: "${String(raw !== null && raw !== void 0 ? raw : '')}"`, {
|
|
87
|
+
itemIndex: i,
|
|
88
|
+
description: 'Use the international format, e.g. 966501234567. Saudi local numbers (05XXXXXXXX) are converted automatically.',
|
|
89
|
+
});
|
|
70
90
|
}
|
|
71
91
|
const response = await GenericFunctions_1.corbitApiRequest.call(this, 'POST', '/api/v1/send', { senderName, number, messageBody: message, sendAtOption: 'NOW' }, { headers, itemIndex: i });
|
|
72
92
|
const sent = ((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : {});
|
|
@@ -79,15 +99,16 @@ class CorbitSms {
|
|
|
79
99
|
const raw = (0, GenericFunctions_1.splitNumbers)(this.getNodeParameter('numbers', i));
|
|
80
100
|
const invalid = raw.filter((n) => !(0, GenericFunctions_1.normalizeNumber)(n));
|
|
81
101
|
if (invalid.length > 0) {
|
|
82
|
-
throw new n8n_workflow_1.NodeOperationError(node, `
|
|
102
|
+
throw new n8n_workflow_1.NodeOperationError(node, `'Numbers' contains invalid mobile numbers: ${invalid.slice(0, 5).join(', ')}${invalid.length > 5 ? ` and ${invalid.length - 5} more` : ''}`, {
|
|
83
103
|
itemIndex: i,
|
|
84
|
-
description: 'Corbit SMS rejects the whole request if any number is invalid, so nothing was sent.',
|
|
104
|
+
description: 'Use the international format, e.g. 966501234567. Corbit SMS rejects the whole request if any number is invalid, so nothing was sent.',
|
|
85
105
|
});
|
|
86
106
|
}
|
|
87
107
|
const numbers = [...new Set(raw.map((n) => (0, GenericFunctions_1.normalizeNumber)(n)))];
|
|
88
108
|
if (numbers.length === 0) {
|
|
89
|
-
throw new n8n_workflow_1.NodeOperationError(node, '
|
|
109
|
+
throw new n8n_workflow_1.NodeOperationError(node, "'Numbers' is empty", {
|
|
90
110
|
itemIndex: i,
|
|
111
|
+
description: 'Add at least one mobile number.',
|
|
91
112
|
});
|
|
92
113
|
}
|
|
93
114
|
const response = await GenericFunctions_1.corbitApiRequest.call(this, 'POST', '/api/v1/send-bulk', { senderName, numbers, messageBody: message, sendAtOption: 'Now' }, { headers, itemIndex: i });
|
|
@@ -105,42 +126,53 @@ class CorbitSms {
|
|
|
105
126
|
}
|
|
106
127
|
}
|
|
107
128
|
else if (resource === 'sms' && (operation === 'getStatus' || operation === 'getReport')) {
|
|
108
|
-
const messageId = String(this.getNodeParameter('messageId', i)).trim();
|
|
129
|
+
const messageId = String((_e = this.getNodeParameter('messageId', i)) !== null && _e !== void 0 ? _e : '').trim();
|
|
109
130
|
if (messageId === '') {
|
|
110
|
-
throw new n8n_workflow_1.NodeOperationError(node, '
|
|
131
|
+
throw new n8n_workflow_1.NodeOperationError(node, "'Message ID' is empty", {
|
|
132
|
+
itemIndex: i,
|
|
133
|
+
description: 'Use the message ID returned by the Send or Send Bulk operation.',
|
|
134
|
+
});
|
|
111
135
|
}
|
|
112
136
|
const path = operation === 'getStatus' ? '/api/v1/message-status/' : '/api/v1/message-report/';
|
|
113
137
|
const response = await GenericFunctions_1.corbitApiRequest.call(this, 'POST', path + encodeURIComponent(messageId), undefined, { itemIndex: i });
|
|
114
138
|
if (operation === 'getStatus') {
|
|
115
|
-
const data = ((
|
|
139
|
+
const data = ((_f = response.data) !== null && _f !== void 0 ? _f : {});
|
|
116
140
|
returnData.push({
|
|
117
141
|
json: { messageId, status: data.status },
|
|
118
142
|
pairedItem: { item: i },
|
|
119
143
|
});
|
|
120
144
|
}
|
|
121
145
|
else {
|
|
122
|
-
|
|
146
|
+
const msgs = Array.isArray(response.msgs) ? response.msgs : [];
|
|
147
|
+
const jobId = response.jobId;
|
|
148
|
+
if (msgs.length === 0) {
|
|
149
|
+
returnData.push({ json: { ...response, messageId, jobId }, pairedItem: { item: i } });
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
for (const m of msgs) {
|
|
153
|
+
returnData.push({ json: { ...m, messageId, jobId }, pairedItem: { item: i } });
|
|
154
|
+
}
|
|
155
|
+
}
|
|
123
156
|
}
|
|
124
157
|
}
|
|
125
158
|
else if (resource === 'account' && operation === 'getBalance') {
|
|
126
159
|
const response = await GenericFunctions_1.corbitApiRequest.call(this, 'POST', '/api/v1/get-balance', undefined, {
|
|
127
160
|
itemIndex: i,
|
|
128
161
|
});
|
|
129
|
-
const data = ((
|
|
162
|
+
const data = ((_g = response.data) !== null && _g !== void 0 ? _g : {});
|
|
130
163
|
returnData.push({ json: { balance: data.balance }, pairedItem: { item: i } });
|
|
131
164
|
}
|
|
132
165
|
else if (resource === 'senderName' && operation === 'getAll') {
|
|
133
166
|
const returnAll = this.getNodeParameter('returnAll', i);
|
|
134
167
|
const filters = this.getNodeParameter('filters', i, {});
|
|
135
|
-
|
|
168
|
+
const limit = returnAll ? undefined : this.getNodeParameter('limit', i);
|
|
169
|
+
let senders = await GenericFunctions_1.getAllSenderNames.call(this, filters.status ? undefined : limit);
|
|
136
170
|
if (filters.status) {
|
|
137
171
|
const wanted = String(filters.status).toLowerCase();
|
|
138
172
|
senders = senders.filter((s) => String(s.status).toLowerCase() === wanted);
|
|
139
173
|
}
|
|
140
|
-
if (
|
|
141
|
-
const limit = this.getNodeParameter('limit', i);
|
|
174
|
+
if (limit !== undefined)
|
|
142
175
|
senders = senders.slice(0, limit);
|
|
143
|
-
}
|
|
144
176
|
returnData.push(...senders.map((s) => ({ json: s, pairedItem: { item: i } })));
|
|
145
177
|
}
|
|
146
178
|
else {
|
|
@@ -149,8 +181,12 @@ class CorbitSms {
|
|
|
149
181
|
}
|
|
150
182
|
catch (error) {
|
|
151
183
|
if (this.continueOnFail()) {
|
|
184
|
+
const description = error.description;
|
|
152
185
|
returnData.push({
|
|
153
|
-
json: {
|
|
186
|
+
json: {
|
|
187
|
+
error: error.message,
|
|
188
|
+
...(typeof description === 'string' && description ? { description } : {}),
|
|
189
|
+
},
|
|
154
190
|
pairedItem: { item: i },
|
|
155
191
|
});
|
|
156
192
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CorbitSms.node.js","sourceRoot":"","sources":["../../../nodes/CorbitSms/CorbitSms.node.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CorbitSms.node.js","sourceRoot":"","sources":["../../../nodes/CorbitSms/CorbitSms.node.ts"],"names":[],"mappings":";;;AAyBA,kCAKC;AAjBD,+CAAqF;AACrF,yDAO4B;AAC5B,iEAAwD;AAGxD,SAAgB,WAAW,CAAC,GAAY;;IACvC,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,IA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AI,EAAE;4BACL,KAAK,EAAG,KAAe,CAAC,OAAO;4BAC/B,GAAG,CAAC,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;yBAC1E;wBACD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBAGD,IAAI,KAAK,YAAY,2BAAY,EAAE,CAAC;oBACnC,MAAM,IAAI,2BAAY,CAAC,IAAI,EAAE,KAA8B,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;gBAChF,CAAC;gBACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,EAAE,KAAc,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;YACtE,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AArOD,8BAqOC"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
"node": "n8n-nodes-corbit-sms.corbitSms",
|
|
3
3
|
"nodeVersion": "1.0",
|
|
4
4
|
"codexVersion": "1.0",
|
|
5
|
-
"categories": [
|
|
5
|
+
"categories": [
|
|
6
|
+
"Communication"
|
|
7
|
+
],
|
|
6
8
|
"resources": {
|
|
7
9
|
"credentialDocumentation": [
|
|
8
10
|
{
|
|
@@ -14,5 +16,12 @@
|
|
|
14
16
|
"url": "https://github.com/agamalsa/n8n-nodes-corbit-sms#readme"
|
|
15
17
|
}
|
|
16
18
|
]
|
|
17
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"alias": [
|
|
21
|
+
"SMS",
|
|
22
|
+
"text message",
|
|
23
|
+
"OTP",
|
|
24
|
+
"Saudi Arabia",
|
|
25
|
+
"Corbit"
|
|
26
|
+
]
|
|
18
27
|
}
|
|
@@ -25,25 +25,25 @@ exports.nodeProperties = [
|
|
|
25
25
|
{
|
|
26
26
|
name: 'Get Delivery Report',
|
|
27
27
|
value: 'getReport',
|
|
28
|
-
action: 'Get
|
|
29
|
-
description: 'Get the delivery result for each recipient of a message',
|
|
28
|
+
action: 'Get delivery report of message',
|
|
29
|
+
description: 'Get the delivery result for each recipient of a message, one item per recipient',
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
name: 'Get Status',
|
|
33
33
|
value: 'getStatus',
|
|
34
|
-
action: 'Get
|
|
34
|
+
action: 'Get status of message',
|
|
35
35
|
description: 'Get the current status of a sent message',
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
name: 'Send',
|
|
39
39
|
value: 'send',
|
|
40
|
-
action: 'Send
|
|
40
|
+
action: 'Send SMS',
|
|
41
41
|
description: 'Send an SMS to one mobile number',
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
name: 'Send Bulk',
|
|
45
45
|
value: 'sendBulk',
|
|
46
|
-
action: 'Send
|
|
46
|
+
action: 'Send SMS to many numbers',
|
|
47
47
|
description: 'Send the same SMS to many mobile numbers in one request',
|
|
48
48
|
},
|
|
49
49
|
],
|
|
@@ -59,7 +59,7 @@ exports.nodeProperties = [
|
|
|
59
59
|
{
|
|
60
60
|
name: 'Get Balance',
|
|
61
61
|
value: 'getBalance',
|
|
62
|
-
action: 'Get
|
|
62
|
+
action: 'Get account balance',
|
|
63
63
|
description: 'Get the remaining SMS balance of the account',
|
|
64
64
|
},
|
|
65
65
|
],
|
|
@@ -82,14 +82,27 @@ exports.nodeProperties = [
|
|
|
82
82
|
default: 'getAll',
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
|
-
displayName: 'Sender Name
|
|
85
|
+
displayName: 'Sender Name',
|
|
86
86
|
name: 'senderName',
|
|
87
|
-
type: '
|
|
88
|
-
typeOptions: { loadOptionsMethod: 'getSenderNames' },
|
|
87
|
+
type: 'resourceLocator',
|
|
89
88
|
required: true,
|
|
90
|
-
default: '',
|
|
89
|
+
default: { mode: 'list', value: '' },
|
|
91
90
|
displayOptions: { show: { resource: ['sms'], operation: sendOps } },
|
|
92
|
-
description: '
|
|
91
|
+
description: 'Sender name the message is sent from. It must exactly match a sender name that is approved on your Corbit SMS account.',
|
|
92
|
+
modes: [
|
|
93
|
+
{
|
|
94
|
+
displayName: 'From List',
|
|
95
|
+
name: 'list',
|
|
96
|
+
type: 'list',
|
|
97
|
+
typeOptions: { searchListMethod: 'searchSenderNames', searchable: true },
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
displayName: 'By Name',
|
|
101
|
+
name: 'name',
|
|
102
|
+
type: 'string',
|
|
103
|
+
placeholder: 'e.g. MyBrand',
|
|
104
|
+
},
|
|
105
|
+
],
|
|
93
106
|
},
|
|
94
107
|
{
|
|
95
108
|
displayName: 'To',
|
|
@@ -97,9 +110,9 @@ exports.nodeProperties = [
|
|
|
97
110
|
type: 'string',
|
|
98
111
|
required: true,
|
|
99
112
|
default: '',
|
|
100
|
-
placeholder: '
|
|
113
|
+
placeholder: 'e.g. 966501234567',
|
|
101
114
|
displayOptions: { show: { resource: ['sms'], operation: ['send'] } },
|
|
102
|
-
description: 'Mobile number in international format. Saudi local numbers
|
|
115
|
+
description: 'Mobile number in international format, e.g. 966501234567. Saudi local numbers (05XXXXXXXX) are converted automatically; numbers from other countries must use the international format.',
|
|
103
116
|
},
|
|
104
117
|
{
|
|
105
118
|
displayName: 'Numbers',
|
|
@@ -108,9 +121,9 @@ exports.nodeProperties = [
|
|
|
108
121
|
typeOptions: { rows: 4 },
|
|
109
122
|
required: true,
|
|
110
123
|
default: '',
|
|
111
|
-
placeholder: '
|
|
124
|
+
placeholder: 'e.g. 966501234567, 966551234567',
|
|
112
125
|
displayOptions: { show: { resource: ['sms'], operation: ['sendBulk'] } },
|
|
113
|
-
description: '
|
|
126
|
+
description: 'Comma-separated mobile numbers in international format (new lines also work). If any number is invalid, nothing is sent.',
|
|
114
127
|
},
|
|
115
128
|
{
|
|
116
129
|
displayName: 'Message',
|
|
@@ -121,6 +134,7 @@ exports.nodeProperties = [
|
|
|
121
134
|
default: '',
|
|
122
135
|
displayOptions: { show: { resource: ['sms'], operation: sendOps } },
|
|
123
136
|
description: 'Text of the SMS, up to 1600 characters',
|
|
137
|
+
placeholder: 'e.g. Your verification code is 4821',
|
|
124
138
|
},
|
|
125
139
|
{
|
|
126
140
|
displayName: 'Options',
|
|
@@ -142,7 +156,7 @@ exports.nodeProperties = [
|
|
|
142
156
|
name: 'idempotencyKey',
|
|
143
157
|
type: 'string',
|
|
144
158
|
default: '',
|
|
145
|
-
description: 'A unique value (up to 255 characters). If the request is retried with the same key, the first result is returned and nothing is sent again.',
|
|
159
|
+
description: 'A unique value per message (up to 255 characters), for example an expression that combines the execution ID with the ID of the item. If the same request is retried with the same key, the first result is returned and nothing is sent again. Do not use one fixed key for many items.',
|
|
146
160
|
},
|
|
147
161
|
],
|
|
148
162
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CorbitSmsDescription.js","sourceRoot":"","sources":["../../../nodes/CorbitSms/CorbitSmsDescription.ts"],"names":[],"mappings":";;;AAEA,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAExB,QAAA,cAAc,GAAsB;IAChD;QACC,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE;YACR,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;YACrC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE;YAC5C,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;SAC7B;QACD,OAAO,EAAE,KAAK;KACd;IAKD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE;QAC/C,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,qBAAqB;gBAC3B,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"CorbitSmsDescription.js","sourceRoot":"","sources":["../../../nodes/CorbitSms/CorbitSmsDescription.ts"],"names":[],"mappings":";;;AAEA,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAExB,QAAA,cAAc,GAAsB;IAChD;QACC,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE;YACR,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;YACrC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE;YAC5C,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;SAC7B;QACD,OAAO,EAAE,KAAK;KACd;IAKD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE;QAC/C,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,qBAAqB;gBAC3B,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,gCAAgC;gBACxC,WAAW,EAAE,iFAAiF;aAC9F;YACD;gBACC,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,uBAAuB;gBAC/B,WAAW,EAAE,0CAA0C;aACvD;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,UAAU;gBAClB,WAAW,EAAE,kCAAkC;aAC/C;YACD;gB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E;QACX,cAAc,EAAE;YACf,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE;SAC7E;QACD,WAAW,EAAE,iCAAiC;KAC9C;IACD;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;QAC7E,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACR,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;oBACvC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;oBACrC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;oBACrC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;iBACvC;gBACD,OAAO,EAAE,UAAU;gBACnB,WAAW,EAAE,2CAA2C;aACxD;SACD;KACD;CACD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IDataObject, IExecuteFunctions, IHttpRequestMethods, ILoadOptionsFunctions, INode } from 'n8n-workflow';
|
|
2
2
|
export declare const MAX_MESSAGE_LENGTH = 1600;
|
|
3
|
+
export declare const MAX_IDEMPOTENCY_KEY_LENGTH = 255;
|
|
3
4
|
type Context = IExecuteFunctions | ILoadOptionsFunctions;
|
|
4
5
|
export interface CorbitRequestExtras {
|
|
5
6
|
qs?: IDataObject;
|
|
@@ -8,7 +9,7 @@ export interface CorbitRequestExtras {
|
|
|
8
9
|
}
|
|
9
10
|
export declare function normalizeNumber(raw: unknown): string | undefined;
|
|
10
11
|
export declare function splitNumbers(value: unknown): string[];
|
|
11
|
-
export declare function checkMessage(node: INode,
|
|
12
|
+
export declare function checkMessage(node: INode, raw: unknown, itemIndex: number): string;
|
|
12
13
|
export declare function corbitApiRequest(this: Context, method: IHttpRequestMethods, path: string, body?: IDataObject, extras?: CorbitRequestExtras): Promise<IDataObject>;
|
|
13
|
-
export declare function getAllSenderNames(this: Context): Promise<IDataObject[]>;
|
|
14
|
+
export declare function getAllSenderNames(this: Context, maxItems?: number): Promise<IDataObject[]>;
|
|
14
15
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_MESSAGE_LENGTH = void 0;
|
|
3
|
+
exports.MAX_IDEMPOTENCY_KEY_LENGTH = exports.MAX_MESSAGE_LENGTH = void 0;
|
|
4
4
|
exports.normalizeNumber = normalizeNumber;
|
|
5
5
|
exports.splitNumbers = splitNumbers;
|
|
6
6
|
exports.checkMessage = checkMessage;
|
|
@@ -8,17 +8,20 @@ exports.corbitApiRequest = corbitApiRequest;
|
|
|
8
8
|
exports.getAllSenderNames = getAllSenderNames;
|
|
9
9
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
10
10
|
exports.MAX_MESSAGE_LENGTH = 1600;
|
|
11
|
+
exports.MAX_IDEMPOTENCY_KEY_LENGTH = 255;
|
|
11
12
|
function normalizeNumber(raw) {
|
|
12
13
|
if (raw === null || raw === undefined)
|
|
13
14
|
return undefined;
|
|
14
15
|
let digits = String(raw).replace(/\D/g, '');
|
|
15
16
|
if (digits.startsWith('00'))
|
|
16
17
|
digits = digits.slice(2);
|
|
17
|
-
if (/^05\d{8}$/.test(digits))
|
|
18
|
+
else if (/^05\d{8}$/.test(digits))
|
|
18
19
|
digits = '966' + digits.slice(1);
|
|
19
20
|
else if (/^5\d{8}$/.test(digits))
|
|
20
21
|
digits = '966' + digits;
|
|
21
|
-
|
|
22
|
+
else if (digits.startsWith('0'))
|
|
23
|
+
return undefined;
|
|
24
|
+
return /^[1-9]\d{7,14}$/.test(digits) ? digits : undefined;
|
|
22
25
|
}
|
|
23
26
|
function splitNumbers(value) {
|
|
24
27
|
if (Array.isArray(value))
|
|
@@ -30,33 +33,42 @@ function splitNumbers(value) {
|
|
|
30
33
|
.map((v) => v.trim())
|
|
31
34
|
.filter((v) => v !== '');
|
|
32
35
|
}
|
|
33
|
-
function checkMessage(node,
|
|
36
|
+
function checkMessage(node, raw, itemIndex) {
|
|
37
|
+
const message = raw === null || raw === undefined ? '' : String(raw);
|
|
34
38
|
if (message.trim() === '') {
|
|
35
|
-
throw new n8n_workflow_1.NodeOperationError(node, '
|
|
39
|
+
throw new n8n_workflow_1.NodeOperationError(node, "'Message' is empty", {
|
|
40
|
+
itemIndex,
|
|
41
|
+
description: 'Enter the text of the SMS.',
|
|
42
|
+
});
|
|
36
43
|
}
|
|
37
44
|
if (message.length > exports.MAX_MESSAGE_LENGTH) {
|
|
38
|
-
throw new n8n_workflow_1.NodeOperationError(node, `
|
|
45
|
+
throw new n8n_workflow_1.NodeOperationError(node, `'Message' is ${message.length} characters; the limit is ${exports.MAX_MESSAGE_LENGTH}`, { itemIndex });
|
|
39
46
|
}
|
|
47
|
+
return message;
|
|
40
48
|
}
|
|
49
|
+
const CODE_HINTS = {
|
|
50
|
+
INSUFFICIENT_BALANCE: 'Your Corbit SMS balance is not enough. Top up at sms.corbit.sa and run the node again.',
|
|
51
|
+
SENDER_NOT_ALLOWED: "This sender name is not approved on your account. Pick one from the 'Sender Name' list.",
|
|
52
|
+
DUPLICATE: "The same text was sent to the same number within the last hour. Turn on 'Allow Duplicate' to send it again on purpose.",
|
|
53
|
+
IDEMPOTENCY_IN_PROGRESS: 'A request with the same idempotency key is still being processed. Wait a moment and try again.',
|
|
54
|
+
IDEMPOTENCY_KEY_REUSED: "This idempotency key was already used for a different message. Use a different 'Idempotency Key' for each message, for example with an expression.",
|
|
55
|
+
};
|
|
41
56
|
function errorFromBody(node, statusCode, body, headers, itemIndex) {
|
|
57
|
+
var _a;
|
|
42
58
|
const apiMessage = typeof body.message === 'string' && body.message ? body.message : '';
|
|
43
59
|
const code = typeof body.code === 'string' ? body.code : '';
|
|
44
|
-
let description = code ? `
|
|
60
|
+
let description = code ? (_a = CODE_HINTS[code]) !== null && _a !== void 0 ? _a : `Corbit SMS code: ${code}` : undefined;
|
|
45
61
|
if (statusCode === 401) {
|
|
46
|
-
description =
|
|
62
|
+
description = "The API token was rejected. Check 'API Token' in the Corbit SMS credential.";
|
|
47
63
|
}
|
|
48
|
-
else if (statusCode === 429) {
|
|
64
|
+
else if (statusCode === 429 || code === 'RATE_LIMIT') {
|
|
49
65
|
const retryAfter = headers['retry-after'];
|
|
50
|
-
description = `Too many requests. ${retryAfter ? `Try again in ${String(retryAfter)} seconds. ` : ''}You can turn on
|
|
51
|
-
}
|
|
52
|
-
else if (code === 'DUPLICATE') {
|
|
53
|
-
description =
|
|
54
|
-
'The same text was sent to the same number within the last hour. Turn on "Allow Duplicate" to send it again on purpose.';
|
|
66
|
+
description = `Too many requests. ${retryAfter ? `Try again in ${String(retryAfter)} seconds. ` : ''}You can turn on 'Retry On Fail' in the node settings.`;
|
|
55
67
|
}
|
|
56
68
|
return new n8n_workflow_1.NodeApiError(node, body, {
|
|
57
69
|
message: apiMessage || `Corbit SMS returned HTTP ${statusCode}`,
|
|
58
70
|
description,
|
|
59
|
-
httpCode: String(statusCode),
|
|
71
|
+
...(statusCode >= 400 ? { httpCode: String(statusCode) } : {}),
|
|
60
72
|
itemIndex,
|
|
61
73
|
});
|
|
62
74
|
}
|
|
@@ -95,28 +107,35 @@ async function corbitApiRequest(method, path, body, extras = {}) {
|
|
|
95
107
|
}
|
|
96
108
|
const parsed = data && typeof data === 'object' && !Array.isArray(data) ? data : {};
|
|
97
109
|
if (statusCode >= 400 || parsed.status === 'Error') {
|
|
98
|
-
throw errorFromBody(this.getNode(), statusCode
|
|
110
|
+
throw errorFromBody(this.getNode(), statusCode, parsed, (_b = response.headers) !== null && _b !== void 0 ? _b : {}, extras.itemIndex);
|
|
99
111
|
}
|
|
100
112
|
if (Array.isArray(data))
|
|
101
113
|
return { data };
|
|
102
114
|
return parsed;
|
|
103
115
|
}
|
|
104
|
-
async function getAllSenderNames() {
|
|
116
|
+
async function getAllSenderNames(maxItems) {
|
|
105
117
|
var _a;
|
|
106
118
|
const perPage = 50;
|
|
107
119
|
const all = [];
|
|
120
|
+
let previousFirst;
|
|
108
121
|
for (let page = 1; page <= 100; page++) {
|
|
109
122
|
const response = await corbitApiRequest.call(this, 'GET', '/api/v1/sendernames', undefined, {
|
|
110
123
|
qs: { per_page: perPage, page },
|
|
111
124
|
});
|
|
112
125
|
const items = Array.isArray(response.data) ? response.data : [];
|
|
126
|
+
if (items.length === 0)
|
|
127
|
+
break;
|
|
128
|
+
const first = JSON.stringify(items[0]);
|
|
129
|
+
if (page > 1 && first === previousFirst)
|
|
130
|
+
break;
|
|
131
|
+
previousFirst = first;
|
|
113
132
|
all.push(...items);
|
|
133
|
+
if (maxItems !== undefined && all.length >= maxItems)
|
|
134
|
+
break;
|
|
114
135
|
const pagination = ((_a = response.pagination) !== null && _a !== void 0 ? _a : {});
|
|
115
136
|
const total = Number(pagination.total);
|
|
116
137
|
const currentPage = Number(pagination.current_page);
|
|
117
138
|
const pageSize = Number(pagination.per_page) || perPage;
|
|
118
|
-
if (items.length === 0)
|
|
119
|
-
break;
|
|
120
139
|
if (Number.isFinite(total) && all.length >= total)
|
|
121
140
|
break;
|
|
122
141
|
if (!Number.isFinite(total) && items.length < pageSize)
|
|
@@ -124,6 +143,6 @@ async function getAllSenderNames() {
|
|
|
124
143
|
if (Number.isFinite(currentPage) && currentPage !== page)
|
|
125
144
|
break;
|
|
126
145
|
}
|
|
127
|
-
return all;
|
|
146
|
+
return maxItems === undefined ? all : all.slice(0, maxItems);
|
|
128
147
|
}
|
|
129
148
|
//# sourceMappingURL=GenericFunctions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/CorbitSms/GenericFunctions.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/CorbitSms/GenericFunctions.ts"],"names":[],"mappings":";;;AA6BA,0CAQC;AAGD,oCAOC;AAMD,oCAgBC;AA4CD,4CAiDC;AAMD,8CAyBC;AAxLD,+CAAgE;AAEnD,QAAA,kBAAkB,GAAG,IAAI,CAAC;AAC1B,QAAA,0BAA0B,GAAG,GAAG,CAAC;AAiB9C,SAAgB,eAAe,CAAC,GAAY;IAC3C,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxD,IAAI,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC5C,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACjD,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC/D,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;SACrD,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAClD,OAAO,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5D,CAAC;AAGD,SAAgB,YAAY,CAAC,KAAc;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,K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
|
4
4
|
"description": "n8n node for Corbit SMS: send SMS (single and bulk), check delivery status and reports, read the balance and sender names.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/agamalsa/n8n-nodes-corbit-sms#readme",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@n8n/node-cli": "
|
|
48
|
+
"@n8n/node-cli": "0.55.5",
|
|
49
49
|
"eslint": "9.32.0",
|
|
50
50
|
"prettier": "3.6.2",
|
|
51
51
|
"release-it": "^21.1.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-corbit-sms",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "n8n node for Corbit SMS: send SMS (single and bulk), check delivery status and reports, read the balance and sender names.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/agamalsa/n8n-nodes-corbit-sms#readme",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@n8n/node-cli": "
|
|
48
|
+
"@n8n/node-cli": "0.55.5",
|
|
49
49
|
"eslint": "9.32.0",
|
|
50
50
|
"prettier": "3.6.2",
|
|
51
51
|
"release-it": "^21.1.0",
|