@cuecue/osc 0.0.27 → 0.0.31
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/dist/index.js +25 -14
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import createDebug from 'debug';
|
|
3
|
-
import { BasePlugin } from '@cuecue/core';
|
|
4
|
-
import isObject from 'lodash/isObject';
|
|
5
|
-
import isArray from 'lodash/isArray';
|
|
1
|
+
'use strict';
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var nodeOsc = require('node-osc');
|
|
6
|
+
var createDebug = require('debug');
|
|
7
|
+
var core = require('@cuecue/core');
|
|
8
|
+
var isObject = require('lodash/isObject');
|
|
9
|
+
var isArray = require('lodash/isArray');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var createDebug__default = /*#__PURE__*/_interopDefaultLegacy(createDebug);
|
|
14
|
+
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
15
|
+
var isArray__default = /*#__PURE__*/_interopDefaultLegacy(isArray);
|
|
16
|
+
|
|
17
|
+
class Base extends core.BasePlugin {
|
|
8
18
|
constructor(opts = {}) {
|
|
9
19
|
super({
|
|
10
20
|
port: process.env.OSC_PORT || 8081,
|
|
@@ -12,7 +22,7 @@ class Base extends BasePlugin {
|
|
|
12
22
|
...opts
|
|
13
23
|
});
|
|
14
24
|
this.osc = null;
|
|
15
|
-
this.debug =
|
|
25
|
+
this.debug = createDebug__default["default"]('cuecue:osc');
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
async onInitialized() {
|
|
@@ -42,7 +52,7 @@ class OscInput extends Base {
|
|
|
42
52
|
} = {}) {
|
|
43
53
|
super(opts);
|
|
44
54
|
this.commands = commands;
|
|
45
|
-
this.debug =
|
|
55
|
+
this.debug = createDebug__default["default"]('cuecue:input:osc');
|
|
46
56
|
this.onMessage = this.onMessage.bind(this);
|
|
47
57
|
}
|
|
48
58
|
|
|
@@ -58,7 +68,7 @@ class OscInput extends Base {
|
|
|
58
68
|
host
|
|
59
69
|
} = this.options;
|
|
60
70
|
return new Promise(resolve => {
|
|
61
|
-
this.osc = new Server(port, host, () => {
|
|
71
|
+
this.osc = new nodeOsc.Server(port, host, () => {
|
|
62
72
|
resolve();
|
|
63
73
|
});
|
|
64
74
|
this.osc.on('message', this.onMessage);
|
|
@@ -96,7 +106,7 @@ class OscInput extends Base {
|
|
|
96
106
|
class OscOutput extends Base {
|
|
97
107
|
constructor(opts) {
|
|
98
108
|
super(opts);
|
|
99
|
-
this.debug =
|
|
109
|
+
this.debug = createDebug__default["default"]('cuecue:output:osc');
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
async onInit() {
|
|
@@ -105,7 +115,7 @@ class OscOutput extends Base {
|
|
|
105
115
|
host,
|
|
106
116
|
port
|
|
107
117
|
} = this.options;
|
|
108
|
-
this.osc = new Client(host, port);
|
|
118
|
+
this.osc = new nodeOsc.Client(host, port);
|
|
109
119
|
}
|
|
110
120
|
|
|
111
121
|
cue(cue, extraData = null) {
|
|
@@ -139,7 +149,7 @@ class OscOutput extends Base {
|
|
|
139
149
|
return Promise.resolve();
|
|
140
150
|
}
|
|
141
151
|
|
|
142
|
-
const values =
|
|
152
|
+
const values = isArray__default["default"](value) ? value : [value];
|
|
143
153
|
return Promise.all(values.map(val => {
|
|
144
154
|
const {
|
|
145
155
|
command: finalCommand = command,
|
|
@@ -153,7 +163,7 @@ class OscOutput extends Base {
|
|
|
153
163
|
|
|
154
164
|
this.debug('command: %s %o', finalCommand, finalArgs);
|
|
155
165
|
const path = finalCommand.replace(/^\/?/, '/');
|
|
156
|
-
const sendArgs = finalArgs.filter(it => it !== null && !
|
|
166
|
+
const sendArgs = finalArgs.filter(it => it !== null && !isObject__default["default"](it) && !isArray__default["default"](it));
|
|
157
167
|
return this.send(path, ...sendArgs);
|
|
158
168
|
}));
|
|
159
169
|
}
|
|
@@ -175,4 +185,5 @@ class OscOutput extends Base {
|
|
|
175
185
|
|
|
176
186
|
}
|
|
177
187
|
|
|
178
|
-
|
|
188
|
+
exports.Input = OscInput;
|
|
189
|
+
exports.Output = OscOutput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuecue/osc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/runtime": "^7.12.5",
|
|
43
|
-
"@cuecue/core": "^0.0.
|
|
43
|
+
"@cuecue/core": "^0.0.31",
|
|
44
44
|
"debug": "^4.3.1",
|
|
45
45
|
"lodash": "^4.17.20",
|
|
46
46
|
"node-osc": "^5.2.2"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "bc6f4b36d80e298f4f70cb3f581f5bf3f856dadd"
|
|
52
52
|
}
|