@sndwrks/osc-cli 1.0.3 → 1.2.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
@@ -1,144 +1,242 @@
1
- # OSC CLI Tool
1
+ ![sndwrks logo](images/sndwrks-square_200px-high.png)
2
2
 
3
- **DISCLAIMER: this was written by AI, but it will be maintained by humans (probably)**
3
+ # osc-cli
4
4
 
5
- A simple command-line application for sending and receiving OSC (Open Sound Control) messages via TCP and UDP.
5
+ **DISCLAIMER: this was written by AI, and promptly rewritten, but it will be maintained by humans (probably).**
6
6
 
7
- ## Features
7
+ A simple command-line application for sending and receiving OSC (Open Sound Control) messages via TCP and UDP including load testing.
8
+
9
+ ## What does it do?
8
10
 
9
11
  - Listen for OSC messages via UDP
10
12
  - Listen for OSC messages via TCP
11
13
  - Listen on both protocols simultaneously
12
14
  - Send OSC messages via UDP
13
15
  - Send OSC messages via TCP
14
- - Logging with @sndwrks/lumberjack
15
- - **Installable as a global CLI tool**
16
+ - Load Testing with UDP
17
+ - Load Testing with TCP
16
18
 
17
19
  ## Installation
18
20
 
19
- ### Install Globally
20
-
21
- ```bash
22
- npm install -g .
23
- ```
24
-
25
- After installation, you can use the `osc-cli` command from anywhere:
21
+ ### Install from npm
26
22
 
27
23
  ```bash
28
- osc-cli listen-udp 8000
24
+ npm install -g @sndwrks/osc-cli
29
25
  ```
30
26
 
31
- ### Install as Dependency
27
+ ### Install from Github
32
28
 
33
29
  ```bash
34
- npm install
35
- ```
30
+ # clone the repo
31
+ git clone git@github.com:sndwrks/osc-cli.git
36
32
 
37
- ### Install from npm
33
+ # install globally
34
+ npm i -g .
38
35
 
39
- ```bash
40
- npm install -g @sndwrks/osc-cli
36
+ # otherwise build and run locally
37
+ npm i
38
+ npm run build
39
+ npm start -- <commands>
41
40
  ```
42
41
 
43
- ## Build
42
+ ## Uninstall
44
43
 
45
44
  ```bash
46
- npm run build
45
+ npm uninstall -g osc-cli
47
46
  ```
48
47
 
49
48
  ## Usage
50
49
 
51
- Once installed globally, use the `osc-cli` command. If not installed globally, use `npm start` instead.
50
+ Once installed globally, use `osc-cli <command>`. If not installed globally, use `npm start -- <command>` instead.
52
51
 
53
- ```bash
54
- npm start -- listen-udp <port>
55
- npm start -- listen-tcp <port>
56
- npm start -- listen-both <udp-port> <tcp-port>
57
- ```
58
52
 
59
53
  ### Listen for OSC Messages
60
54
 
61
- **UDP (default port 57121):**
55
+ Starts a server to listen for incoming OSC messages.
56
+
57
+ #### Args
58
+
59
+ | Flag | Option | Type | Description | Example | Default |
60
+ |------|--------|------|-------------|---------|---------|
61
+ | `-i` | `--ip-address <ip-address>` | string | IP address to bind to | 127.0.0.1 | 0.0.0.0 |
62
+ | `-p` | `--port <port>` | number | Port the server listens on | 53000 | 51000 |
63
+
64
+ **UDP (default port 51000):**
62
65
  ```bash
63
66
  osc-cli listen-udp
64
- osc-cli listen-udp 8000
67
+ osc-cli listen-udp -p 8000
68
+ osc-cli listen-udp --port 8000 --ip-address 127.0.0.1
65
69
  ```
66
70
 
67
- **TCP (default port 57122):**
71
+ **TCP (default port 51001):**
68
72
  ```bash
69
73
  osc-cli listen-tcp
70
- osc-cli listen-tcp 8001
74
+ osc-cli listen-tcp -p 8001
75
+ osc-cli listen-tcp --port 8001 --ip-address 127.0.0.1
71
76
  ```
72
77
 
73
78
  **Both UDP and TCP:**
74
79
  ```bash
75
80
  osc-cli listen-both
76
- osc-cli listen-both 8000 8001
81
+ osc-cli listen-both --udp-port 8000 --tcp-port 8001
82
+ osc-cli listen-both --udp-port 8000 --tcp-port 8001 --udp-ip-address 127.0.0.1 --tcp-ip-address 127.0.0.1
77
83
  ```
78
84
 
79
85
  ### Send OSC Messages
80
86
 
87
+ Send a single OSC message.
88
+
89
+ #### Args
90
+
91
+ Sends a single OSC message via UDP
92
+
93
+ | Flag | Option | Type | Description | Example | Default |
94
+ |------|--------|------|-------------|---------|---------|
95
+ | | `--udp-ip-address <udp-ip-address>` | string | IP address to bind the UDP server to | 127.0.0.1 | |
96
+ | | `--udp-port <udp-port>` | number | Port the UDP server will listen on | 53000 | 51000 |
97
+ | | `--tcp-ip-address <tcp-ip-address>` | string | IP address to bind the TCP server to | 127.0.0.1 | 0.0.0.0 |
98
+ | | `--tcp-port <tcp-port>` | number | Port the TCP server will listen on | 53001 | 51001 |
99
+
100
+
81
101
  **UDP:**
82
102
  ```bash
83
- osc-cli send-udp /test hello 123 127.0.0.1 57121
84
- osc-cli send-udp /synth/note 440 0.5 localhost 8000
103
+ # no args
104
+ osc-cli send-udp -a /test -i 127.0.0.1 -p 57121
105
+
106
+ # with args
107
+ osc-cli send-udp -a /test -i 127.0.0.1 -p 57121 --args hello 123
108
+ osc-cli send-udp --address /synth/note --ip-address localhost --port 8000 --args 440 0.5
85
109
  ```
86
110
 
87
111
  **TCP:**
88
- NOTE: This is currently broken due to issue in osc.js
89
112
  ```bash
90
- osc-cli send-tcp /test hello 123 127.0.0.1 57122
91
- osc-cli send-tcp /synth/note 440 0.5 localhost 8001
113
+ osc-cli send-tcp -a /test -i 127.0.0.1 -p 57122 --args hello 123
114
+ osc-cli send-tcp --address /synth/note --ip-address localhost --port 8001 --args 440 0.5
92
115
  ```
93
116
 
94
- ## Message Format
117
+ ### Load Testing
95
118
 
96
- - **Address**: OSC address pattern (e.g., `/test`, `/synth/freq`)
97
- - **Args**: Space-separated values (automatically parsed as numbers if possible)
98
- - **Host**: Target hostname or IP address (default: 127.0.0.1)
99
- - **Port**: Target port number
100
-
101
- ## Examples
102
-
103
- ```bash
104
- # Install globally
105
- npm install -g .
119
+ The load testing allows for sending multiple messages in batches. The batches may overlap if the message rate is slower than the batch interval.
106
120
 
107
- # Start listening on UDP port 8000
108
- osc-cli listen-udp 8000
121
+ #### Args
109
122
 
110
- # In another terminal, send a message
111
- osc-cli send-udp /hello world 127.0.0.1 8000
123
+ | Flag | Option | Type | Required | Description | Example | Default |
124
+ |------|--------|------|----------|-------------|---------|---------|
125
+ | | `--local-ip-address <local-ip-address>` | string | No | Local IP Address to bind the client to | | 0.0.0.0 |
126
+ | | `--local-port <local-port>` | number | No | Local port to bind the client to | | 51000 |
127
+ | | `--remote-ip-address <remote-ip-address>` | string | Yes | IP Address to send the messages to | 10.10.209.5 | |
128
+ | | `--remote-port <remote-port>` | number | Yes | Port to send the messages to | | |
129
+ | | `--messages-per-batch <messages-per-batch>` | number | Yes | The number of messages per batch to send | | |
130
+ | | `--message-rate <message-rate>` | number | No | The number of messages to send per second | | |
131
+ | | `--total-batches <total-batches>` | number | Yes | The total number of batches to send | | |
132
+ | | `--batch-interval <batch-interval>` | number | Yes | The time in seconds between batches | | |
133
+ | | `--custom-address <custom-address>` | string | No | A custom address to send | | /sndwrks/osc-cli-load-tester/test |
112
134
 
113
- # Listen on both protocols
114
- osc-cli listen-both 9000 9001
115
-
116
- # Send via TCP
117
- osc-cli send-tcp /synth/freq 440 127.0.0.1 9001
135
+ **UDP Load Test:**
136
+ ```bash
137
+ # minimal required args
138
+ osc-cli osc-load-test-udp \
139
+ --remote-ip-address 127.0.0.1 \
140
+ --remote-port 8000 \
141
+ --messages-per-batch 100 \
142
+ --total-batches 10 \
143
+ --batch-interval 1
118
144
  ```
119
145
 
120
- ## Development
146
+ ```bash
147
+ # with optional args
148
+ osc-cli osc-load-test-udp \
149
+ --remote-ip-address 10.10.209.5 \
150
+ --remote-port 8000 \
151
+ --messages-per-batch 100 \
152
+ --total-batches 10 \
153
+ --batch-interval 1 \
154
+ --message-rate 50
155
+ ```
121
156
 
122
- If you haven't installed globally, you can use npm scripts:
157
+ ```bash
158
+ osc-cli osc-load-test-udp \
159
+ --local-ip-address 0.0.0.0 \
160
+ --local-port 51000 \
161
+ --remote-ip-address 10.10.209.5 \
162
+ --remote-port 8000 \
163
+ --messages-per-batch 100 \
164
+ --message-rate 50 \
165
+ --total-batches 10 \
166
+ --batch-interval 1 \
167
+ --custom-address /my/custom/address
168
+ ```
123
169
 
170
+ **TCP Load Test:**
124
171
  ```bash
125
- npm run build # Build TypeScript
126
- npm start listen-udp # Run with npm start
172
+ # minimal required args
173
+ osc-cli osc-load-test-tcp \
174
+ --remote-ip-address 127.0.0.1 \
175
+ --remote-port 8001 \
176
+ --messages-per-batch 100 \
177
+ --total-batches 10 \
178
+ --batch-interval 1
127
179
  ```
128
180
 
129
- ## Uninstall
181
+ ```bash
182
+ # with optional args
183
+ osc-cli osc-load-test-tcp \
184
+ --remote-ip-address 10.10.209.5 \
185
+ --remote-port 8001 \
186
+ --messages-per-batch 100 \
187
+ --total-batches 10 \
188
+ --batch-interval 1 \
189
+ --message-rate 50
190
+ ```
130
191
 
131
192
  ```bash
132
- npm uninstall -g osc-cli
193
+ # with all args
194
+ osc-cli osc-load-test-tcp \
195
+ --local-ip-address 0.0.0.0 \
196
+ --local-port 51000 \
197
+ --remote-ip-address 10.10.209.5 \
198
+ --remote-port 8001 \
199
+ --messages-per-batch 100 \
200
+ --message-rate 50 \
201
+ --total-batches 10 \
202
+ --batch-interval 1 \
203
+ --custom-address /my/custom/address
133
204
  ```
134
205
 
135
- ## Publishing to NPM
136
206
 
137
- See [PUBLISHING.md](PUBLISHING.md) for detailed instructions on how to publish this package to npm with the TypeScript build step.
207
+ ## Development
208
+
209
+ Please get in there if you want. This repo uses eslint 8 for linting AND code style.
210
+
211
+ **VSCode Example Settings**
212
+ ```json
213
+ {
214
+ "editor.formatOnSave": true,
215
+ "eslint.codeActionsOnSave.rules": null,
216
+ "eslint.validate": [
217
+ "typescript"
218
+ ],
219
+ "[typescript]": {
220
+ "editor.tabSize": 2,
221
+ "editor.formatOnSave": true,
222
+ "editor.codeActionsOnSave": {
223
+ "source.fixAll.eslint": "explicit"
224
+ }
225
+ },
226
+ "eslint.format.enable": true,
227
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint",
228
+ "editor.tabSize": 2,
229
+ "javascript.updateImportsOnFileMove.enabled": "always",
230
+ "editor.rulers": [100]
231
+ }
232
+ ```
138
233
 
139
- ## Dependencies
234
+ ```bash
235
+ npm run build
236
+ npm start listen-udp -- <args>
237
+ ```
140
238
 
141
- - `osc`: OSC protocol implementation
142
- - `@sndwrks/lumberjack`: Winston-based logging library
239
+ ## Wants and Desires
143
240
 
144
- **Note:** This package includes custom TypeScript type definitions for the `osc` library in `src/types/osc.d.ts` since the osc package doesn't provide its own types.
241
+ - roll in nodemon
242
+ - add some way to send messages on an interval
package/dist/cli.js CHANGED
@@ -1,68 +1,129 @@
1
1
  #!/usr/bin/env node
2
- import { listenUDP, listenTCP, sendUDP, sendTCP, logger, } from './index.js';
3
- // CLI Interface
4
- const args = process.argv.slice(2);
5
- const command = args[0];
6
- switch (command) {
7
- case 'listen-udp':
8
- const udpPort = parseInt(args[1]) || 57121;
9
- listenUDP(udpPort);
10
- break;
11
- case 'listen-tcp':
12
- const tcpPort = parseInt(args[1]) || 57122;
13
- listenTCP(tcpPort);
14
- break;
15
- case 'listen-both':
16
- const udpBothPort = parseInt(args[1]) || 57121;
17
- const tcpBothPort = parseInt(args[2]) || 57122;
18
- listenUDP(udpBothPort);
19
- listenTCP(tcpBothPort);
20
- logger.info('Listening on both UDP and TCP');
21
- break;
22
- case 'send-udp':
23
- if (args.length < 2) {
24
- logger.error('Usage: send-udp <address> [args...] [host] [port]');
25
- process.exit(1);
26
- }
27
- const udpAddress = args[1];
28
- const udpArgs = args.slice(2, -2).map((arg) => {
29
- const num = parseFloat(arg);
30
- return isNaN(num) ? arg : num;
31
- });
32
- const udpHost = args[args.length - 2] || '127.0.0.1';
33
- const udpSendPort = parseInt(args[args.length - 1]) || 57121;
34
- sendUDP(udpAddress, udpArgs, udpHost, udpSendPort);
35
- break;
36
- case 'send-tcp':
37
- if (args.length < 2) {
38
- logger.error('Usage: send-tcp <address> [args...] [host] [port]');
39
- process.exit(1);
40
- }
41
- const tcpAddress = args[1];
42
- const tcpArgs = args.slice(2, -2).map((arg) => {
43
- const num = parseFloat(arg);
44
- return isNaN(num) ? arg : num;
45
- });
46
- const tcpHost = args[args.length - 2] || '127.0.0.1';
47
- const tcpSendPort = parseInt(args[args.length - 1]) || 57122;
48
- sendTCP(tcpAddress, tcpArgs, tcpHost, tcpSendPort);
49
- break;
50
- default:
51
- console.log(`
52
- OSC CLI Tool
53
-
54
- Usage:
55
- osc-cli listen-udp [port] - Listen for UDP OSC messages (default port: 57121)
56
- osc-cli listen-tcp [port] - Listen for TCP OSC messages (default port: 57122)
57
- osc-cli listen-both [udpPort] [tcpPort] - Listen on both UDP and TCP
58
- osc-cli send-udp <address> [args...] [host] [port] - Send OSC via UDP
59
- osc-cli send-tcp <address> [args...] [host] [port] - Send OSC via TCP
60
-
61
- Examples:
62
- osc-cli listen-udp 8000
63
- osc-cli listen-both 8000 8001
64
- osc-cli send-udp /test hello 123 127.0.0.1 8000
65
- osc-cli send-tcp /synth/freq 440 localhost 8001
66
- `);
67
- break;
68
- }
2
+ import { program } from 'commander';
3
+ import { beginLogging, configureLogger } from '@sndwrks/lumberjack';
4
+ import { startUdpServer } from './osc-servers/udpServer.js';
5
+ import { startTcpServer } from './osc-servers/tcpServer.js';
6
+ import { sendTcpMessage } from './osc-senders/sendTcpMessage.js';
7
+ import { sendUdpMessage } from './osc-senders/sendUdpMessage.js';
8
+ import { createOscUdpLoadTest } from './osc-load-test/oscLoadTestUdp.js';
9
+ import { createOscTcpLoadTest } from './osc-load-test/oscLoadTestTcp.js';
10
+ configureLogger({
11
+ logToConsole: {
12
+ enabled: true,
13
+ type: 'pretty',
14
+ },
15
+ logLevel: 'info',
16
+ service: 'osc-cli',
17
+ });
18
+ const logger = beginLogging({ name: 'osc-cli' });
19
+ // at a certain point these commands should move to other files if this cli grows
20
+ program
21
+ .command('listen-udp')
22
+ .name('listen-udp')
23
+ .description('Start a server that logs incoming UDP OSC messages.')
24
+ .option('-i, --ip-address <ip-address>', 'IP address to bind to. Example: 127.0.0.1. Default: 0.0.0.0')
25
+ .option('-p, --port <port>', 'Port the server listens on. Example: 53000 Default: 51000')
26
+ .action(({ ipAddress, port }) => {
27
+ startUdpServer(logger, ipAddress, port);
28
+ });
29
+ program
30
+ .command('listen-tcp')
31
+ .name('listen-tcp')
32
+ .description('Starts a server the logs incoming TCP OSC messages')
33
+ .option('-i, --ip-address <ip-address>', 'IP address to bind to. Example: 127.0.0.1. Default: 0.0.0.0')
34
+ .option('-p, --port <port>', 'Port the server listens on. Example: 53001 Default: 51001')
35
+ .action(({ ipAddress, port }) => {
36
+ startTcpServer(logger, ipAddress, port);
37
+ });
38
+ program
39
+ .command('listen-both')
40
+ .name('listen-both')
41
+ .description('Starts two servers, one for TCP and one for UDP')
42
+ .option('--udp-ip-address <udp-ip-address>', 'IP address to bind the UDP server to. Example 127.0.0.1')
43
+ .option('--udp-port <udp-port>', 'Port the UDP server will listen on. Example: 53000 Default: 51000')
44
+ .option('--tcp-ip-address <tcp-ip-address>', 'IP address to bind the TCP server to. Example: 127.0.0.1. Default: 0.0.0.0')
45
+ .option('--tcp-port <tcp-port>', 'Port the TCP server will listen on. Example: 53001 Default: 51001')
46
+ .action(({ udpIpAddress, udpPort, tcpIpAddress, tcpPort, }) => {
47
+ startUdpServer(logger, udpIpAddress, udpPort);
48
+ startTcpServer(logger, tcpIpAddress, tcpPort);
49
+ });
50
+ program
51
+ .command('send-udp')
52
+ .name('send-udp')
53
+ .description('Send an OSC message via UDP')
54
+ .requiredOption('-i, --ip-address <ip-address>', 'IP address to send to (required). Example: 10.0.10.223')
55
+ .requiredOption('-p, --port <port>', 'Port to send to (required). Example: 53000')
56
+ .requiredOption('-a, --address <address>', 'OSC Address to send (required). Example: /fader/1/mute/on')
57
+ .option('--args <args...>', 'A space separated list of arguments (optional). Example: 1.0 string 59')
58
+ .action(({ ipAddress, port, address, args, }) => {
59
+ sendUdpMessage(logger, ipAddress, port, address, args);
60
+ });
61
+ program
62
+ .command('send-tcp')
63
+ .name('send-tcp')
64
+ .description('Send an OSC message via TCP.')
65
+ .requiredOption('-i, --ip-address <ip-address>', 'IP address to send to (required). Example: 10.0.10.223')
66
+ .requiredOption('-p, --port <port>', 'Port to send to (required). Example: 53000')
67
+ .requiredOption('-a, --address <address>', 'OSC Address to send (required). Example: /fader/1/mute/on')
68
+ .option('--args <args...>', 'A space separated list of arguments. Example: 1.0 string 59')
69
+ .action(({ ipAddress, port, address, args, }) => {
70
+ sendTcpMessage(logger, ipAddress, port, address, args);
71
+ });
72
+ program
73
+ .command('osc-load-test-udp')
74
+ .name('osc-load-test-udp')
75
+ .description('Starts an OSC load test via UDP. Sends batches of messages on intervals of at least 1 second. If there\'s more messages per batch than can be sent in the interval batches will overlap. The load tester adds one arg in the format \'Batch: <batch-number> Message: <message-number>\'')
76
+ .option('--local-ip-address <local-ip-address>', 'Local IP Address to bind the client to. Default: 0.0.0.0')
77
+ .option('--local-port <local-port>', 'Local port to bind the client to. Default: 51000')
78
+ .requiredOption('--remote-ip-address <remote-ip-address>', 'IP Address to send the messages to (required). Example: 10.10.209.5')
79
+ .requiredOption('--remote-port <remote-port>', 'Port to send the messages to (required).')
80
+ .requiredOption('--messages-per-batch <messages-per-batch>', 'The number of messages per batch to send (required).')
81
+ .option('--message-rate <message-rate>', 'The number of messages to send per second.')
82
+ .requiredOption('--total-batches <total-batches>', 'The total number of batches to send')
83
+ .requiredOption('--batch-interval <batch-interval', 'The time in seconds between batches.')
84
+ .option('--custom-address <custom-address>', 'A custom address to send. Default: /sndwrks/osc-cli-load-tester/test')
85
+ .action(async ({ localIpAddress, localPort, remoteIpAddress, remotePort, messagesPerBatch, messageRate, totalBatches, batchInterval, customAddress, }) => {
86
+ const oscLoadTestTest = createOscUdpLoadTest({
87
+ logger,
88
+ localIpAddress,
89
+ localPort,
90
+ remoteIpAddress,
91
+ remotePort,
92
+ messagesPerBatch,
93
+ messageRate,
94
+ totalBatches,
95
+ batchInterval,
96
+ customAddress,
97
+ });
98
+ await oscLoadTestTest.start();
99
+ });
100
+ program
101
+ .command('osc-load-test-tcp')
102
+ .name('osc-load-test-tcp')
103
+ .description('Starts an OSC load test via TCP. Sends batches of messages on intervals of at least 1 second. If there\'s more messages per batch than can be sent in the interval batches will overlap. The load tester adds one arg in the format \'Batch: <batch-number> Message: <message-number>\'')
104
+ .option('--local-ip-address <local-ip-address>', 'Local IP Address to bind the client to. Default: 0.0.0.0')
105
+ .option('--local-port <local-port>', 'Local port to bind the client to. Default: 51000')
106
+ .requiredOption('--remote-ip-address <remote-ip-address>', 'IP Address to send the messages to (required). Example: 10.10.209.5')
107
+ .requiredOption('--remote-port <remote-port>', 'Port to send the messages to (required).')
108
+ .requiredOption('--messages-per-batch <messages-per-batch>', 'The number of messages per batch to send (required).')
109
+ .option('--message-rate <message-rate>', 'The number of messages to send per second.')
110
+ .requiredOption('--total-batches <total-batches>', 'The total number of batches to send')
111
+ .requiredOption('--batch-interval <batch-interval', 'The time in seconds between batches.')
112
+ .option('--custom-address <custom-address>', 'A custom address to send. Default: /sndwrks/osc-cli-load-tester/test')
113
+ .action(async ({ localIpAddress, localPort, remoteIpAddress, remotePort, messagesPerBatch, messageRate, totalBatches, batchInterval, customAddress, }) => {
114
+ const oscLoadTestTest = createOscTcpLoadTest({
115
+ logger,
116
+ localIpAddress,
117
+ localPort,
118
+ remoteIpAddress,
119
+ remotePort,
120
+ messagesPerBatch,
121
+ messageRate,
122
+ totalBatches,
123
+ batchInterval,
124
+ customAddress,
125
+ });
126
+ await oscLoadTestTest.start();
127
+ });
128
+ program.parse();
129
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,O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M,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;QAC7D,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACnD,MAAM;IAER,KAAK,UAAU;QACb,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;YAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAC5C,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;YAC5B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,WAAW,CAAC;QACrD,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;QAC7D,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACnD,MAAM;IAER;QACE,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;KAeX,CAAC,CAAC;QACH,MAAM;AACV,CAAC"}
package/dist/index.js CHANGED
@@ -1,17 +1,7 @@
1
1
  import osc from 'osc';
2
- import { beginLogging, configureLogger } from '@sndwrks/lumberjack';
2
+ import { beginLogging } from '@sndwrks/lumberjack';
3
3
  import * as net from 'node:net';
4
- // Configure logger globally
5
- configureLogger({
6
- logToConsole: {
7
- enabled: true,
8
- type: 'pretty',
9
- },
10
- logLevel: 'info',
11
- service: 'osc-cli',
12
- });
13
- // Create logger instance
14
- const logger = beginLogging({ name: 'OSC-CLI' });
4
+ const logger = beginLogging({ name: 'yeet ' });
15
5
  /**
16
6
  * Listen for OSC messages via UDP
17
7
  */
@@ -48,7 +38,7 @@ export function listenTCP(port = 57122) {
48
38
  tcpPort.on('ready', () => {
49
39
  logger.info(`Listening for OSC over TCP on port ${port}`);
50
40
  });
51
- tcpPort.on('data', (oscMsg) => {
41
+ tcpPort.on('message', (oscMsg) => {
52
42
  logger.info('TCP OSC message received:', {
53
43
  address: oscMsg.address,
54
44
  args: oscMsg.args,
@@ -121,3 +111,4 @@ export function sendTCP(address, args, host = '127.0.0.1', port = 57122) {
121
111
  tcpPort.open(host, port);
122
112
  }
123
113
  export { logger };
114
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAEhC,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAE/C;;GAEG;AACH,MAAM,UAAU,SAAS,CAAE,OAAe,KAAK;IAC7C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC;QAC9B,YAAY,EAAE,SAAS;QACvB,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC,sCAAsC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,MAAW,EAAE,EAAE;QAC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AAM,OAAO,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC;QACpC,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,+BAA+B,OAAO,WAAW,IAAI,WAAW,IAAI,WAAW,IAAI,EAAE,CAAC,CAAC;IAEnG,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC,kCAAkC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QAE9D,OAAO,CAAC,IAAI,CAAC;YACX,OAAO;YACP,IAAI;SACL,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAEhD,sBAAsB;QACtB,UAAU,CAAC,GAAG,EAAE;YACd,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;QACjC,MAAM,CAAC,KAAK,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,82 @@
1
+ import osc from 'osc';
2
+ export function createOscTcpLoadTest({ logger, localIpAddress = '0.0.0.0', localPort = 51000, remoteIpAddress, remotePort, messagesPerBatch, messageRate, totalBatches, batchInterval, customAddress = '/sndwrks/osc-cli-load-tester/test', }) {
3
+ let oscClient = null;
4
+ // this could call sendTcpMessage
5
+ // my inclination is in a library like this its nice for each bit to be self contained
6
+ async function initializeClient() {
7
+ oscClient = new osc.TCPSocketPort({
8
+ address: localIpAddress,
9
+ port: localPort,
10
+ });
11
+ return new Promise((resolve) => {
12
+ if (oscClient) {
13
+ // these listeners never get cleaned up but that shouldn't be a problem
14
+ oscClient.on('ready', () => {
15
+ logger.info('Client opened successfully.');
16
+ resolve();
17
+ });
18
+ oscClient.on('error', (e) => {
19
+ logger.error(e);
20
+ });
21
+ oscClient.open(remoteIpAddress, remotePort);
22
+ }
23
+ });
24
+ }
25
+ function sendMessages(batchNumber) {
26
+ if (!oscClient) {
27
+ logger.error(new Error('OSC Server not initialized!'));
28
+ return;
29
+ }
30
+ function recursiveSendMessage(messageNumber) {
31
+ const newMessageNumber = messageNumber + 1;
32
+ if (oscClient) {
33
+ oscClient.send({
34
+ address: customAddress,
35
+ args: [
36
+ {
37
+ type: 's',
38
+ value: `Batch: ${batchNumber} Message: ${newMessageNumber}`,
39
+ },
40
+ ],
41
+ });
42
+ if (!(newMessageNumber < messagesPerBatch))
43
+ return;
44
+ if (messageRate) {
45
+ // could possibly clean up this timeout?
46
+ setTimeout(() => {
47
+ recursiveSendMessage(newMessageNumber);
48
+ }, 1000 / messageRate);
49
+ }
50
+ else {
51
+ recursiveSendMessage(newMessageNumber);
52
+ }
53
+ }
54
+ }
55
+ recursiveSendMessage(0);
56
+ }
57
+ function recursiveRun(batchNumber) {
58
+ const newIndex = batchNumber + 1;
59
+ logger.info(`Starting run #${newIndex}`);
60
+ sendMessages(batchNumber);
61
+ if (newIndex < totalBatches) {
62
+ setTimeout(() => {
63
+ recursiveRun(newIndex);
64
+ }, 1000 * batchInterval);
65
+ }
66
+ else {
67
+ logger.info(`Batches complete. Total Batches: ${totalBatches} Total Messages Sent: ${messagesPerBatch * totalBatches}`);
68
+ process.exit(0);
69
+ }
70
+ }
71
+ async function start() {
72
+ try {
73
+ await initializeClient();
74
+ recursiveRun(0);
75
+ }
76
+ catch (e) {
77
+ logger.error(e);
78
+ }
79
+ }
80
+ return { start };
81
+ }
82
+ //# sourceMappingURL=oscLoadTestTcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oscLoadTestTcp.js","sourceRoot":"","sources":["../../src/osc-load-test/oscLoadTestTcp.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAiBtB,MAAM,UAAU,oBAAoB,CAAE,EACpC,MAAM,EACN,cAAc,GAAG,SAAS,EAC1B,SAAS,GAAG,KAAK,EACjB,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,GAAG,mCAAmC,GAC1B;IACzB,IAAI,SAAS,GAA6B,IAAI,CAAC;IAE/C,iCAAiC;IACjC,sFAAsF;IACtF,KAAK,UAAU,gBAAgB;QAC7B,SAAS,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC;YAChC,OAAO,EAAE,cAAc;YACvB,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;QAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,IAAI,SAAS,EAAE,CAAC;gBACd,uEAAuE;gBACvE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;oBACzB,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;oBAC3C,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC,CAAC;gBAEH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oBAC1B,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC,CAAC,CAAC;gBAEH,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,SAAS,YAAY,CAAE,WAAmB;QACxC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,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,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,KAAK,UAAU,KAAK;QAClB,IAAI,CAAC;YACH,MAAM,gBAAgB,EAAE,CAAC;YAEzB,YAAY,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,85 @@
1
+ import osc from 'osc';
2
+ export function createOscUdpLoadTest({ logger, localIpAddress = '0.0.0.0', localPort = 51000, remoteIpAddress, remotePort, messagesPerBatch, messageRate, totalBatches, batchInterval, customAddress = '/sndwrks/osc-cli-load-tester/test', }) {
3
+ let oscClient = null;
4
+ // could this perhaps call sendUdpMessage... perhaps
5
+ // DRY or whatever 🤷🏻
6
+ async function initializeClient() {
7
+ oscClient = new osc.UDPPort({
8
+ localAddress: localIpAddress,
9
+ localPort,
10
+ remoteAddress: remoteIpAddress,
11
+ remotePort,
12
+ });
13
+ return new Promise((resolve) => {
14
+ logger.info('Attempting OSC Client initialization.');
15
+ if (oscClient) {
16
+ // these listeners never get cleaned up but that shouldn't be a problem
17
+ oscClient.on('ready', () => {
18
+ logger.info('Client opened successfully.');
19
+ resolve();
20
+ });
21
+ oscClient.on('error', (e) => {
22
+ logger.error(e);
23
+ });
24
+ oscClient.open();
25
+ }
26
+ });
27
+ }
28
+ function sendMessages(batchNumber) {
29
+ if (!oscClient) {
30
+ logger.error(new Error('OSC Server not initialized!'));
31
+ return;
32
+ }
33
+ function recursiveSendMessage(messageNumber) {
34
+ const newMessageNumber = messageNumber + 1;
35
+ if (oscClient) {
36
+ oscClient.send({
37
+ address: customAddress,
38
+ args: [
39
+ {
40
+ type: 's',
41
+ value: `Batch: ${batchNumber} Message: ${newMessageNumber}`,
42
+ },
43
+ ],
44
+ });
45
+ if (!(newMessageNumber < messagesPerBatch))
46
+ return;
47
+ if (messageRate) {
48
+ // could possibly clean up this timeout?
49
+ setTimeout(() => {
50
+ recursiveSendMessage(newMessageNumber);
51
+ }, 1000 / messageRate);
52
+ }
53
+ else {
54
+ recursiveSendMessage(newMessageNumber);
55
+ }
56
+ }
57
+ }
58
+ recursiveSendMessage(0);
59
+ }
60
+ function recursiveRun(batchNumber) {
61
+ const newIndex = batchNumber + 1;
62
+ logger.info(`Starting run #${newIndex}`);
63
+ sendMessages(batchNumber);
64
+ if (newIndex < totalBatches) {
65
+ setTimeout(() => {
66
+ recursiveRun(newIndex);
67
+ }, 1000 * batchInterval);
68
+ }
69
+ else {
70
+ logger.info(`Batches complete. Total Batches: ${totalBatches} Total Messages Sent: ${messagesPerBatch * totalBatches}`);
71
+ process.exit(0);
72
+ }
73
+ }
74
+ async function start() {
75
+ try {
76
+ await initializeClient();
77
+ recursiveRun(0);
78
+ }
79
+ catch (e) {
80
+ logger.error(e);
81
+ }
82
+ }
83
+ return { start };
84
+ }
85
+ //# sourceMappingURL=oscLoadTestUdp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oscLoadTestUdp.js","sourceRoot":"","sources":["../../src/osc-load-test/oscLoadTestUdp.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAiBtB,MAAM,UAAU,oBAAoB,CAAE,EACpC,MAAM,EACN,cAAc,GAAG,SAAS,EAC1B,SAAS,GAAG,KAAK,EACjB,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,GAAG,mCAAmC,GAC1B;IACzB,IAAI,SAAS,GAAuB,IAAI,CAAC;IAEzC,oDAAoD;IACpD,uBAAuB;IACvB,KAAK,UAAU,gBAAgB;QAC7B,SAAS,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC;YAC1B,YAAY,EAAE,cAAc;YAC5B,SAAS;YACT,aAAa,EAAE,eAAe;YAC9B,UAAU;SACX,CAAC,CAAC;QAEH,OA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zB,CAAC;qBAAM,CAAC;oBACN,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;gBACzC,CAAC;YACH,CAAC;QACH,CAAC;QAED,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,SAAS,YAAY,CAAE,WAAmB;QACxC,MAAM,QAAQ,GAAG,WAAW,GAAG,CAAC,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;QACzC,YAAY,CAAC,WAAW,CAAC,CAAC;QAE1B,IAAI,QAAQ,GAAG,YAAY,EAAE,CAAC;YAC5B,UAAU,CAAC,GAAG,EAAE;gBACd,YAAY,CAAC,QAAQ,CAAC,CAAC;YACzB,CAAC,EAAE,IAAI,GAAG,aAAa,CAAC,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,oCAAoC,YAAY,yBAAyB,gBAAgB,GAAG,YAAY,EAAE,CAAC,CAAC;YACxH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,KAAK,UAAU,KAAK;QAClB,IAAI,CAAC;YACH,MAAM,gBAAgB,EAAE,CAAC;YAEzB,YAAY,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import osc from 'osc';
2
+ import { argsToTypedArgs } from './utilities.js';
3
+ // eslint-disable-next-line import/prefer-default-export
4
+ export function sendTcpMessage(logger, ipAddress, port, address, args) {
5
+ const tcpPort = new osc.TCPSocketPort({
6
+ address: '0.0.0.0',
7
+ port: 52010,
8
+ });
9
+ tcpPort.on('ready', () => {
10
+ logger.info(`Sending OSC message via TCP to ${ipAddress}:${port}`);
11
+ const typedArgs = args ? argsToTypedArgs(args) : [];
12
+ tcpPort.send({
13
+ address,
14
+ args: typedArgs,
15
+ });
16
+ logger.info('Message sent: %s %o', address, args);
17
+ setTimeout(() => {
18
+ tcpPort.close();
19
+ process.exit(0);
20
+ }, 100);
21
+ });
22
+ tcpPort.on('error', (e) => {
23
+ logger.error('TCP Send Error: %s', e.message);
24
+ });
25
+ tcpPort.open(ipAddress, port);
26
+ }
27
+ //# sourceMappingURL=sendTcpMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendTcpMessage.js","sourceRoot":"","sources":["../../src/osc-senders/sendTcpMessage.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAItB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wDAAwD;AACxD,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,SAAiB,EACjB,IAAY,EACZ,OAAe,EACf,IAAe;IAEf,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC;QACpC,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC,kCAAkC,SAAS,IAAI,IAAI,EAAE,CAAC,CAAC;QAEnE,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEpD,OAAO,CAAC,IAAI,CAAC;YACX,OAAO;YACP,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAElD,UAAU,CAAC,GAAG,EAAE;YACd,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE;QAC/B,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import osc from 'osc';
2
+ import { argsToTypedArgs } from './utilities.js';
3
+ // eslint-disable-next-line import/prefer-default-export
4
+ export function sendUdpMessage(logger, ipAddress, port, address, args) {
5
+ const udpPort = new osc.UDPPort({
6
+ localAddress: '0.0.0.0',
7
+ localPort: 0,
8
+ metadata: true,
9
+ });
10
+ udpPort.on('ready', () => {
11
+ logger.info(`Sending OSC message via UDP to ${ipAddress}:${port}`);
12
+ const typedArgs = args ? argsToTypedArgs(args) : [];
13
+ udpPort.send({
14
+ address,
15
+ args: typedArgs,
16
+ }, ipAddress, port);
17
+ logger.info('Message sent: %s %o', address, args);
18
+ setTimeout(() => {
19
+ udpPort.close();
20
+ process.exit(0);
21
+ }, 100);
22
+ });
23
+ udpPort.on('error', (e) => {
24
+ logger.error('UDP Send Error: %s', e.message);
25
+ });
26
+ udpPort.open();
27
+ }
28
+ //# sourceMappingURL=sendUdpMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendUdpMessage.js","sourceRoot":"","sources":["../../src/osc-senders/sendUdpMessage.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAItB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wDAAwD;AACxD,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,SAAiB,EACjB,IAAY,EACZ,OAAe,EACf,IAAc;IAEd,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC;QAC9B,YAAY,EAAE,SAAS;QACvB,SAAS,EAAE,CAAC;QACZ,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC,kCAAkC,SAAS,IAAI,IAAI,EAAE,CAAC,CAAC;QAEnE,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEpD,OAAO,CAAC,IAAI,CACV;YACE,OAAO;YACP,IAAI,EAAE,SAAS;SAChB,EACD,SAAS,EACT,IAAI,CACL,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAElD,UAAU,CAAC,GAAG,EAAE;YACd,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE;QAC/B,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC"}
@@ -0,0 +1,19 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export function argsToTypedArgs(args) {
3
+ return args.map((arg) => {
4
+ let type = 's';
5
+ let value = arg;
6
+ const num = parseFloat(arg);
7
+ if (!Number.isNaN(num)) {
8
+ value = num;
9
+ if (arg.includes('.')) {
10
+ type = 'f';
11
+ }
12
+ else {
13
+ type = 'i';
14
+ }
15
+ }
16
+ return { type, value };
17
+ });
18
+ }
19
+ //# sourceMappingURL=utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../src/osc-senders/utilities.ts"],"names":[],"mappings":"AAEA,wDAAwD;AACxD,MAAM,UAAU,eAAe,CAAE,IAAc;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACtB,IAAI,IAAI,GAAG,GAAG,CAAC;QACf,IAAI,KAAK,GAAoB,GAAG,CAAC;QACjC,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,KAAK,GAAG,GAAG,CAAC;YACZ,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtB,IAAI,GAAG,GAAG,CAAC;YACb,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,GAAG,CAAC;YACb,CAAC;QACH,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,24 @@
1
+ import osc from 'osc';
2
+ import * as net from 'node:net';
3
+ // eslint-disable-next-line import/prefer-default-export
4
+ export function startTcpServer(logger, ipAddress = '0.0.0.0', port = 51001) {
5
+ const tcpServer = net.createServer((socket) => {
6
+ const tcpPort = new osc.TCPSocketPort({
7
+ socket,
8
+ metadata: true,
9
+ });
10
+ tcpPort.on('message', (oscMsg) => {
11
+ logger.info('--tcp osc-- Address: %o Arguments: %o', oscMsg.address, oscMsg.args);
12
+ });
13
+ tcpPort.on('error', (err) => {
14
+ logger.error('TCP Error:', err);
15
+ });
16
+ });
17
+ tcpServer.on('error', (e) => {
18
+ logger.error(e);
19
+ });
20
+ tcpServer.listen(port, ipAddress, () => {
21
+ logger.info(`Listening for OSC over TCP on IP Address: ${ipAddress} Port: ${port}`);
22
+ });
23
+ }
24
+ //# sourceMappingURL=tcpServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tcpServer.js","sourceRoot":"","sources":["../../src/osc-servers/tcpServer.ts"],"names":[],"mappings":"AAAA,OAAO,GAAmB,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAIhC,wDAAwD;AACxD,MAAM,UAAU,cAAc,CAAE,MAAc,EAAE,YAAoB,SAAS,EAAE,OAAe,KAAK;IACjG,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;QAC5C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC;YACpC,MAAM;YACN,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,MAAkB,EAAE,EAAE;YAC3C,MAAM,CAAC,IAAI,CAAC,uCAAuC,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACpF,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;YACjC,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;QAC1B,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,IAAI,CAAC,6CAA6C,SAAS,UAAU,IAAI,EAAE,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,21 @@
1
+ import osc from 'osc';
2
+ // eslint-disable-next-line import/prefer-default-export
3
+ export function startUdpServer(logger, ipAddress = '0.0.0.0', port = 51000) {
4
+ const udpPort = new osc.UDPPort({
5
+ localAddress: ipAddress,
6
+ localPort: port,
7
+ metadata: true,
8
+ });
9
+ udpPort.on('ready', () => {
10
+ logger.info(`Listening for OSC over UDP on IP Address: ${ipAddress} Port: ${port}`);
11
+ });
12
+ udpPort.on('message', (oscMsg) => {
13
+ logger.info('--udp osc-- Address: %o Arguments: %o', oscMsg.address, oscMsg.args);
14
+ });
15
+ udpPort.on('error', (err) => {
16
+ logger.error('UDP Error:', err);
17
+ });
18
+ udpPort.open();
19
+ return udpPort;
20
+ }
21
+ //# sourceMappingURL=udpServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"udpServer.js","sourceRoot":"","sources":["../../src/osc-servers/udpServer.ts"],"names":[],"mappings":"AAAA,OAAO,GAAmB,MAAM,KAAK,CAAC;AAGtC,wDAAwD;AACxD,MAAM,UAAU,cAAc,CAAE,MAAc,EAAE,YAAoB,SAAS,EAAE,OAAe,KAAK;IACjG,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC;QAC9B,YAAY,EAAE,SAAS;QACvB,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC,6CAA6C,SAAS,UAAU,IAAI,EAAE,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,MAAkB,EAAE,EAAE;QAC3C,MAAM,CAAC,IAAI,CAAC,uCAAuC,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;QACjC,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,EAAE,CAAC;IACf,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sndwrks/osc-cli",
3
- "version": "1.0.3",
3
+ "version": "1.2.0",
4
4
  "description": "Simple OSC command-line tool",
5
5
  "keywords": [
6
6
  "osc",
@@ -38,15 +38,16 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@sndwrks/lumberjack": "^0.8.0",
41
+ "commander": "^14.0.2",
41
42
  "osc": "^2.4.5"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@types/node": "^20.0.0",
45
- "typescript": "^5.0.0",
46
46
  "@typescript-eslint/eslint-plugin": "^8.50.1",
47
47
  "@typescript-eslint/parser": "^8.34.1",
48
48
  "eslint": "^8.57.1",
49
49
  "eslint-config-airbnb-base": "^15.0.0",
50
- "eslint-import-resolver-typescript": "^4.4.3"
50
+ "eslint-import-resolver-typescript": "^4.4.3",
51
+ "typescript": "^5.0.0"
51
52
  }
52
53
  }