@soundworks/core
Advanced tools
Comparing version 3.3.2 to 3.3.3
@@ -261,2 +261,19 @@ "use strict"; | ||
sanitizeSchema: def => { | ||
// sanitize `null` values in received schema, this prevent a bug when | ||
// `min` and `max` are explicitely set to `±Infinity`, the schema is stringified | ||
// when sent over the network and therefore Infinity is transformed to `null` | ||
// | ||
// JSON.parse({ a: Infinity }); | ||
// > { "a": null } | ||
if (def.min === null) { | ||
def.min = -Infinity; | ||
} | ||
if (def.max === null) { | ||
def.max = Infinity; | ||
} | ||
return def; | ||
}, | ||
coerceFunction: (name, def, value) => { | ||
@@ -280,2 +297,19 @@ if (!(typeof value === 'number' && Math.floor(value) === value)) { | ||
sanitizeSchema: def => { | ||
// sanitize `null` values in received schema, this prevent a bug when | ||
// `min` and `max` are explicitely set to `±Infinity`, the schema is stringified | ||
// when sent over the network and therefore Infinity is transformed to `null` | ||
// | ||
// JSON.parse({ a: Infinity }); | ||
// > { "a": null } | ||
if (def.min === null) { | ||
def.min = -Infinity; | ||
} | ||
if (def.max === null) { | ||
def.max = Infinity; | ||
} | ||
return def; | ||
}, | ||
coerceFunction: (name, def, value) => { | ||
@@ -390,2 +424,7 @@ if (typeof value !== 'number' || value !== value) { | ||
} = types[def.type]; | ||
if (types[def.type].sanitizeSchema) { | ||
def = types[def.type].sanitizeSchema(def); | ||
} | ||
def = Object.assign({}, defaultOptions, def); // if event property is set to true, the param must | ||
@@ -392,0 +431,0 @@ // be nullable and its default value is `undefined` |
@@ -155,3 +155,3 @@ "use strict"; | ||
event | ||
} = this._parameters.getSchema(name); // @note 20211209 - we have an issue here server-side, because if the value | ||
} = this._parameters.getSchema(name); // @note 20211209 - we had an issue here server-side, because if the value | ||
// is an object or an array, the reference is shared by everybody, therefore | ||
@@ -158,0 +158,0 @@ // `changed` is always false and the new value is never propagated... |
{ | ||
"name": "@soundworks/core", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "full-stack javascript framework for distributed audio visual experiences on the web", | ||
@@ -42,3 +42,2 @@ "authors": [ | ||
"fast-text-encoding": "^1.0.0", | ||
"http-terminator": "^3.2.0", | ||
"isomorphic-ws": "^4.0.1", | ||
@@ -66,3 +65,4 @@ "keyv": "^4.2.2", | ||
"markdown-toc": "^1.2.0", | ||
"mocha": "^9.2.2" | ||
"mocha": "^9.2.2", | ||
"serial-mocha": "^0.0.4" | ||
}, | ||
@@ -69,0 +69,0 @@ "optionalDependencies": { |
@@ -44,4 +44,2 @@ "use strict"; | ||
var _httpTerminator = require("http-terminator"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -522,9 +520,9 @@ | ||
} | ||
} | ||
} // @todo - handle gracefull close of the server | ||
async stop() { | ||
const httpTerminator = (0, _httpTerminator.createHttpTerminator)({ | ||
server: this.httpServer | ||
}); | ||
await httpTerminator.terminate(); | ||
this.sockets.terminate(); | ||
this.httpServer.close(); | ||
return Promise.resolve(); | ||
} | ||
@@ -531,0 +529,0 @@ /** |
@@ -84,2 +84,8 @@ "use strict"; | ||
} | ||
terminate() { | ||
const sockets = this._rooms.get('*'); | ||
sockets.forEach(socket => socket.terminate()); | ||
} | ||
/** @private */ | ||
@@ -86,0 +92,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
171382
19
4231
3
1
11
- Removedhttp-terminator@^3.2.0
- Removedboolean@3.2.0(transitive)
- Removeddelay@5.0.0(transitive)
- Removedfast-printf@1.6.9(transitive)
- Removedhttp-terminator@3.2.0(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedp-timeout@3.2.0(transitive)
- Removedp-wait-for@3.2.0(transitive)
- Removedroarr@7.21.1(transitive)
- Removedsafe-stable-stringify@2.5.0(transitive)
- Removedsemver-compare@1.0.0(transitive)
- Removedtype-fest@2.19.0(transitive)