New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@slimio/config

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slimio/config - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

6

package.json
{
"name": "@slimio/config",
"version": "0.8.0",
"version": "0.9.0",
"description": "SlimIO Reactive JSON Config loaded",

@@ -55,7 +55,7 @@ "main": "index.js",

"@types/lodash.set": "^4.3.4",
"@types/node": "^10.12.5",
"@types/node": "^10.12.9",
"@types/zen-observable": "^0.8.0",
"ava": "^0.25.0",
"eslint": "^5.9.0",
"husky": "^1.1.3",
"husky": "^1.2.0",
"nyc": "^13.1.0",

@@ -62,0 +62,0 @@ "pkg-ok": "^2.3.1"

@@ -13,3 +13,3 @@ # Config

- Reactive with observable key(s)
- Safe with JSON Schema validation
- Safe with [JSON Schema](https://json-schema.org/) validation

@@ -58,3 +58,3 @@ ## Getting Started

## Events
Configuration Class have many events to warn developer when things happen:
Configuration class is extended by a Node.js EventEmitter. The class can trigger several events:

@@ -66,2 +66,3 @@ | event name | description |

| reload | The configuration has been hot reloaded successfully |
| close | Event triggered when the configuration is asked to be closed |

@@ -89,3 +90,3 @@ ## API

> **Note**: When no schema is provided, it will search for a file prefixed by `.schema` with the config name.
> **Note**: When no schema is provided, it will search for a file prefixed by `.schema` with the same config name.

@@ -180,1 +181,18 @@ ### read(defaultPayload?: T): Promise< this >;

Close (and write on disk) the configuration (it will close the watcher and complete/clean all active observers subscribers).
## Properties
### STRINGIFY_SPACE
The `STRINGIFY_SPACE` property allow you to redine the espace used internaly for `JSON.stringify` method. The default value is **4**.
### DEFAULT_SCHEMA
The `DEFAULT_SCHEMA` property allow you to redefine the default schema that should be applied if no schema is provided when constructor is triggered!
The default value is the following Object:
```js
{
title: "CONFIG",
additionalProperties: true
}
```

@@ -101,11 +101,2 @@ // Require Node.JS core packages

// Cleanup closed subscription every second
setInterval(() => {
for (const [fieldPath, subscriptionObservers] of this.subscriptionObservers) {
if (subscriptionObservers.closed) {
this.subscriptionObservers.splice(fieldPath, 1);
}
}
}, 1000);
// Assign defaultSchema is exist!

@@ -264,2 +255,13 @@ if (Reflect.has(options, "defaultSchema")) {

if (!this.configHasBeenRead) {
// Cleanup closed subscription every second
this.cleanupTimeout = setInterval(() => {
for (const [fieldPath, subscriptionObservers] of this.subscriptionObservers) {
if (subscriptionObservers.closed) {
this.subscriptionObservers.splice(fieldPath, 1);
}
}
}, 1000);
}
// Setup config state has "read" true

@@ -571,2 +573,3 @@ this.configHasBeenRead = true;

*
* @fires close
* @throws {Error}

@@ -598,2 +601,7 @@ *

}
// Close cleanup interval
clearInterval(this.cleanupTimeout);
this.emit("close");
this.configHasBeenRead = false;

@@ -600,0 +608,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc