n8n-nodes-befroosh 0.5.0 → 0.7.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
CHANGED
|
@@ -19,7 +19,10 @@ apps/n8n-nodes/
|
|
|
19
19
|
├── nodes/
|
|
20
20
|
│ ├── BefrooshSms/
|
|
21
21
|
│ ├── BefrooshAnalyticsTrigger/ # webhook trigger (verifies + emits events)
|
|
22
|
-
│
|
|
22
|
+
│ ├── BefrooshReplay/ # schedule/cancel/status replay calls
|
|
23
|
+
│ ├── BefrooshAssignAction/ # create + assign an admin task
|
|
24
|
+
│ ├── BefrooshWait/ # pause on an offset schedule
|
|
25
|
+
│ └── BefrooshStatus/ # route by user status (10 outputs)
|
|
23
26
|
├── scripts/copy-icons.mjs # copies .svg/.png into dist after tsc
|
|
24
27
|
├── tsconfig.json
|
|
25
28
|
└── package.json # the "n8n" field registers nodes + credentials
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class BefrooshStatus implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BefrooshStatus = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const eventDefaults_1 = require("../../lib/eventDefaults");
|
|
6
|
+
// Mirrors `UserStatusEnum` in `packages/entities/src/users/user.enum.ts` on the backend.
|
|
7
|
+
// Not imported from there — this package is self-contained/published (CLAUDE.md §10) — so
|
|
8
|
+
// keep this list in sync by hand if the backend enum ever changes.
|
|
9
|
+
const STATUSES = [
|
|
10
|
+
{ name: 'Lost', value: 'lost' },
|
|
11
|
+
{ name: 'Inactive', value: 'inactive' },
|
|
12
|
+
{ name: 'Removed', value: 'removed' },
|
|
13
|
+
{ name: 'New', value: 'new' },
|
|
14
|
+
{ name: 'Onboarding', value: 'onboarding' },
|
|
15
|
+
{ name: 'Needed', value: 'needed' },
|
|
16
|
+
{ name: 'Semi Active', value: 'semiActive' },
|
|
17
|
+
{ name: 'Active', value: 'active' },
|
|
18
|
+
{ name: 'Key User', value: 'keyUser' },
|
|
19
|
+
];
|
|
20
|
+
// Trailing bucket for a status that doesn't match any known value (empty, stale node
|
|
21
|
+
// version, or a future backend status this node hasn't been updated for) — every item
|
|
22
|
+
// still reaches exactly one output, never silently dropped.
|
|
23
|
+
const OTHER_OUTPUT_INDEX = STATUSES.length;
|
|
24
|
+
const OTHER_OUTPUT_NAME = 'Other';
|
|
25
|
+
class BefrooshStatus {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.description = {
|
|
28
|
+
displayName: 'Befroosh Status',
|
|
29
|
+
name: 'befrooshStatus',
|
|
30
|
+
icon: 'file:befroosh.svg',
|
|
31
|
+
group: ['transform'],
|
|
32
|
+
version: 1,
|
|
33
|
+
description: "Route items by the user's status onto a separate output branch per status",
|
|
34
|
+
defaults: { name: 'Befroosh Status' },
|
|
35
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
36
|
+
outputs: STATUSES.map(() => n8n_workflow_1.NodeConnectionTypes.Main).concat(n8n_workflow_1.NodeConnectionTypes.Main),
|
|
37
|
+
outputNames: [...STATUSES.map((s) => s.name), OTHER_OUTPUT_NAME],
|
|
38
|
+
properties: [
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Status',
|
|
41
|
+
name: 'status',
|
|
42
|
+
type: 'string',
|
|
43
|
+
default: `={{ $json.context?.user?.status ?? ${eventDefaults_1.TRIGGER_ITEM_JSON}.context?.user?.status ?? '' }}`,
|
|
44
|
+
required: true,
|
|
45
|
+
description: "The status value to route on. Defaults to the acting user's status from the " +
|
|
46
|
+
'webhook context, resolved regardless of how many nodes sit in between — same ' +
|
|
47
|
+
"fallback pattern as Befroosh Assign Action's User / Lead ID.",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async execute() {
|
|
53
|
+
const items = this.getInputData();
|
|
54
|
+
const outputs = Array.from({ length: STATUSES.length + 1 }, () => []);
|
|
55
|
+
for (let i = 0; i < items.length; i++) {
|
|
56
|
+
try {
|
|
57
|
+
const status = (this.getNodeParameter('status', i) || '').trim();
|
|
58
|
+
const index = STATUSES.findIndex((s) => s.value === status);
|
|
59
|
+
outputs[index === -1 ? OTHER_OUTPUT_INDEX : index].push({
|
|
60
|
+
json: items[i].json,
|
|
61
|
+
pairedItem: { item: i },
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (this.continueOnFail()) {
|
|
66
|
+
outputs[OTHER_OUTPUT_INDEX].push({
|
|
67
|
+
json: { ...items[i].json, error: error.message },
|
|
68
|
+
pairedItem: { item: i },
|
|
69
|
+
});
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return outputs;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.BefrooshStatus = BefrooshStatus;
|
|
79
|
+
//# sourceMappingURL=BefrooshStatus.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BefrooshStatus.node.js","sourceRoot":"","sources":["../../../nodes/BefrooshStatus/BefrooshStatus.node.ts"],"names":[],"mappings":";;;AAAA,+CAMsB;AACtB,2DAA4D;AAE5D,yFAAyF;AACzF,0FAA0F;AAC1F,mEAAmE;AACnE,MAAM,QAAQ,GAA2C;IACvD,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAC/B,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACvC,EAAE,I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,EAAG,KAAe,CAAC,OAAO,EAAE;wBAC3D,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACxB,CAAC,CAAC;oBACH,SAAS;gBACX,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AArDD,wCAqDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><rect width="24" height="24" rx="5" fill="#6366f1"/><path d="M7 12a5 5 0 1 1 1.6 3.7" fill="none" stroke="#fff" stroke-width="2.1" stroke-linecap="round"/><path d="M7 8.5V12h3.5" fill="none" stroke="#fff" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-befroosh",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Befroosh custom n8n nodes (SMS providers, analytics webhook trigger, event replay)",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"dist/nodes/BefrooshAnalyticsTrigger/BefrooshAnalyticsTrigger.node.js",
|
|
44
44
|
"dist/nodes/BefrooshReplay/BefrooshReplay.node.js",
|
|
45
45
|
"dist/nodes/BefrooshAssignAction/BefrooshAssignAction.node.js",
|
|
46
|
-
"dist/nodes/BefrooshWait/BefrooshWait.node.js"
|
|
46
|
+
"dist/nodes/BefrooshWait/BefrooshWait.node.js",
|
|
47
|
+
"dist/nodes/BefrooshStatus/BefrooshStatus.node.js"
|
|
47
48
|
]
|
|
48
49
|
},
|
|
49
50
|
"files": [
|