Skip to content

Commit 130d6b8

Browse files
committed
🤖🌏
0 parents  commit 130d6b8

File tree

15 files changed

+1226
-0
lines changed

15 files changed

+1226
-0
lines changed

.clinerules/testing-preferences.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Brief overview
2+
This set of guidelines outlines the testing preferences for the project, focusing on the avoidance of mocks and specific testing practices.
3+
4+
## Testing strategies
5+
- Never use mocks and jest.mock in tests.
6+
- Prefer black-box tests over white-box tests when possible.
7+
8+
## Testing best practices
9+
- Ensure each test is comprehensive and covers all necessary scenarios.
10+
- Keep tests concise and focused on specific functionality.

.eslintrc.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* @type {import('@types/eslint').ESLint.ConfigData}
3+
*/
4+
module.exports = {
5+
root: true,
6+
7+
env: {
8+
browser: true,
9+
es6: true,
10+
node: true,
11+
},
12+
13+
parser: '@typescript-eslint/parser',
14+
15+
parserOptions: {
16+
project: ['./tsconfig.json'],
17+
sourceType: 'module',
18+
extraFileExtensions: ['.json'],
19+
},
20+
21+
ignorePatterns: ['.eslintrc.js', '**/*.js', '**/node_modules/**', '**/dist/**'],
22+
23+
overrides: [
24+
{
25+
files: ['package.json'],
26+
plugins: ['eslint-plugin-n8n-nodes-base'],
27+
extends: ['plugin:n8n-nodes-base/community'],
28+
rules: {
29+
'n8n-nodes-base/community-package-json-name-still-default': 'off',
30+
},
31+
},
32+
{
33+
files: ['./credentials/**/*.ts'],
34+
plugins: ['eslint-plugin-n8n-nodes-base'],
35+
extends: ['plugin:n8n-nodes-base/credentials'],
36+
rules: {
37+
'n8n-nodes-base/cred-class-field-documentation-url-missing': 'off',
38+
'n8n-nodes-base/cred-class-field-documentation-url-miscased': 'off',
39+
},
40+
},
41+
{
42+
files: ['./nodes/**/*.ts'],
43+
plugins: ['eslint-plugin-n8n-nodes-base'],
44+
extends: ['plugin:n8n-nodes-base/nodes'],
45+
rules: {
46+
'n8n-nodes-base/node-execute-block-missing-continue-on-fail': 'off',
47+
'n8n-nodes-base/node-resource-description-filename-against-convention': 'off',
48+
'n8n-nodes-base/node-param-fixed-collection-type-unsorted-items': 'off',
49+
},
50+
},
51+
],
52+
};

.eslintrc.prepublish.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* @type {import('@types/eslint').ESLint.ConfigData}
3+
*/
4+
module.exports = {
5+
extends: "./.eslintrc.js",
6+
7+
overrides: [
8+
{
9+
files: ['package.json'],
10+
plugins: ['eslint-plugin-n8n-nodes-base'],
11+
rules: {
12+
'n8n-nodes-base/community-package-json-name-still-default': 'error',
13+
},
14+
},
15+
],
16+
};

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
node_modules
2+
*.tsbuildinfo
3+
*.map
4+
coverage
5+
.nyc_output
6+
.vscode
7+
.idea
8+
.DS_Store
9+
*.log
10+
*.tmp
11+
test
12+
tests
13+
dist
14+
pnpm-lock.yaml
15+
*.tgz
16+
.envrc
17+
.env

.npmignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
node_modules
2+
*.ts
3+
*.tsbuildinfo
4+
*.map
5+
coverage
6+
.nyc_output
7+
.vscode
8+
.idea
9+
.DS_Store
10+
*.log
11+
*.tmp
12+
test
13+
tests
14+
*.tgz
15+
.envrc
16+
.env

README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# 📦 n8n-nodes-signal-cli
2+
3+
This repository contains n8n nodes for interacting with Signal CLI. It includes a trigger node for receiving messages and an action node for various Signal operations.
4+
5+
## 📚 Table of Contents
6+
1. [📋 Prerequisites](#-prerequisites)
7+
2. [🚀 Usage](#-usage)
8+
3. [📥 Installation](#-installation)
9+
4. [🤖 Nodes](#-nodes)
10+
5. [💻 Development](#-development)
11+
6. [🚀 Release](#-release)
12+
7. [🤝 Contributing](#-contributing)
13+
8. [⚠️ Known Limitations](#-known-limitations)
14+
9. [📄 License](#-license)
15+
16+
## 📋 Prerequisites
17+
18+
* Node.js (>=18.10) and pnpm (>=9.1)
19+
* n8n installed globally using `pnpm install n8n -g`
20+
* Signal CLI set up and running in daemon mode with HTTP JSON-RPC endpoint exposed (`--http`)
21+
22+
23+
## 📥 Installation
24+
25+
1. Clone this repository.
26+
2. Run `pnpm install` to install dependencies.
27+
3. Run `pnpm build` to build the nodes.
28+
4. Copy the `dist` folder and `package.json` to your n8n custom nodes directory (usually `~/.n8n/custom/nodes/n8n-nodes-signal-cli`).
29+
30+
## 🤖 Nodes
31+
32+
### 🔔 SignalTrigger
33+
34+
* Triggers when a new message is received via Signal CLI.
35+
* Requires Signal CLI API credential.
36+
* Parameters:
37+
* `account`: Signal account to listen for incoming messages.
38+
39+
### 📱 Signal
40+
41+
* Interact with Signal CLI API for various operations.
42+
* Requires Signal CLI API credential.
43+
* Supports the following resources and operations:
44+
* **Message**:
45+
* Send: Send a message to a recipient or group.
46+
* Parameters: `account`, `recipient`, `message`
47+
* **Group**:
48+
* Create: Create a new group.
49+
* Parameters: `account`, `name`, `members`
50+
* List: List all groups.
51+
* Parameters: `account`
52+
* **Contact**:
53+
* Update: Update a contact's name.
54+
* Parameters: `account`, `recipient`, `name`
55+
* List: List all contacts.
56+
* Parameters: `account`
57+
* **Reaction**:
58+
* Send: Send a reaction to a message.
59+
* Parameters: `account`, `recipient`, `reaction`, `targetAuthor`, `timestamp`
60+
* Remove: Remove a reaction from a message.
61+
* Parameters: `account`, `recipient`, `reaction`, `targetAuthor`, `timestamp`
62+
* **Receipt**:
63+
* Send: Send a receipt (read or viewed) for a message.
64+
* Parameters: `account`, `recipient`, `receiptType`, `timestamp`
65+
66+
## 💻 Development
67+
68+
* Run `pnpm dev` to start the TypeScript compiler in watch mode.
69+
* Run `pnpm lint` to check for linting errors.
70+
* Run `pnpm test` to run integration tests.
71+
72+
Before running the tests, set the `ENDPOINT` environment variable to the Signal CLI API URL (e.g., "http://127.0.0.1:8085").
73+
74+
For example, you can run the following command in your terminal:
75+
76+
```bash
77+
export ENDPOINT="http://127.0.0.1:8085" # signal-cli endpoint
78+
export ACCOUNT_NUMBER="±33620382719" # your phone number in international format
79+
```
80+
81+
82+
## 🚀 Release
83+
84+
* Run `pnpm release` to release a new version of the package.
85+
86+
## 🤝 Contributing
87+
88+
Contributions are welcome! Please follow these steps to contribute:
89+
1. Fork this repository.
90+
2. Create a new branch for your feature or bug fix.
91+
3. Submit a pull request with a clear description of your changes.
92+
4. Ensure that your code adheres to the existing coding standards and passes all tests.
93+
94+
## ⚠️ Known Limitations
95+
96+
* This implementation relies on the Signal CLI API, which may have its own limitations and constraints.
97+
* Ensure that the Signal CLI is properly configured and running before using these nodes.
98+
* Some operations may require specific permissions or settings within Signal CLI.
99+
100+
## 📄 License
101+
102+
MIT
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {
2+
ICredentialType,
3+
INodeProperties,
4+
} from 'n8n-workflow';
5+
6+
export class SignalCliApi implements ICredentialType {
7+
name = 'signalCliApi';
8+
displayName = 'Signal CLI API';
9+
properties: INodeProperties[] = [
10+
{
11+
displayName: 'URL',
12+
name: 'url',
13+
type: 'string',
14+
default: process.env.ENDPOINT || '',
15+
placeholder: 'http://localhost:8085',
16+
required: true,
17+
},
18+
{
19+
displayName: 'Account',
20+
name: 'account',
21+
type: 'string',
22+
default: '',
23+
required: true,
24+
},
25+
];
26+
}

gulpfile.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const path = require('path');
2+
const { task, src, dest } = require('gulp');
3+
4+
task('build:icons', copyIcons);
5+
6+
function copyIcons() {
7+
const nodeSource = path.resolve('nodes', '**', '*.{png,svg}');
8+
const nodeDestination = path.resolve('dist', 'nodes');
9+
10+
src(nodeSource).pipe(dest(nodeDestination));
11+
12+
const credSource = path.resolve('credentials', '**', '*.{png,svg}');
13+
const credDestination = path.resolve('dist', 'credentials');
14+
15+
return src(credSource).pipe(dest(credDestination));
16+
}

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
nodes: {
3+
Signal: require('./dist/nodes/Signal/Signal.node').Signal,
4+
SignalTrigger: require('./dist/nodes/SignalTrigger/SignalTrigger.node').SignalTrigger,
5+
},
6+
credentials: {
7+
SignalCliApi: require('./dist/credentials/signalCliApi.credentials').SignalCliApi,
8+
},
9+
};

jest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
5+
prettierPath: require.resolve('prettier'),
6+
testTimeout: 20000,
7+
};

0 commit comments

Comments
 (0)