Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bunt/unit

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bunt/unit - npm Package Compare versions

Comparing version 0.19.1 to 0.19.2

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

## [0.19.2](https://github.com/izatop/bunt/compare/v0.19.1...v0.19.2) (2021-05-27)
### Bug Fixes
* lint ([32f1ce5](https://github.com/izatop/bunt/commit/32f1ce542e6db7a23c5ad8ef7a315a047963c327))
* tests ([64f5a1a](https://github.com/izatop/bunt/commit/64f5a1a38d3207d73aac6b6ed99af0defa57602b))
## [0.19.1](https://github.com/izatop/bunt/compare/v0.19.0...v0.19.1) (2021-05-26)

@@ -8,0 +20,0 @@

6

dist/Context/Context.js
"use strict";
var _IsContext;
var _Context_IsContext;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -11,3 +11,3 @@ exports.Context = void 0;

constructor() {
_IsContext.set(this, void 0);
_Context_IsContext.set(this, void 0);
}

@@ -64,5 +64,5 @@ static async resolve(value) {

exports.Context = Context;
_IsContext = new WeakMap();
_Context_IsContext = new WeakMap();
Context.logger = util_1.Logger.factory(Context);
Context.disposables = new Set();
//# sourceMappingURL=Context.js.map
import { DisposableType, IDisposable } from "../Runtime";
import { Disposer } from "./Disposer";
export declare class Disposable {
static get size(): number;
static attach(target: IDisposable, disposable: DisposableType): void;

@@ -5,0 +6,0 @@ static dispose(target: IDisposable): Promise<void>;

@@ -8,2 +8,5 @@ "use strict";

class Disposable {
static get size() {
return collection.size;
}
static attach(target, disposable) {

@@ -10,0 +13,0 @@ const disposer = this.resolve(target);

@@ -8,16 +8,14 @@ "use strict";

};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _disposable, _disposeHistory, _state, _label;
var _Disposer_disposable, _Disposer_disposeHistory, _Disposer_state, _Disposer_label;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -29,18 +27,18 @@ exports.Disposer = void 0;

constructor(label, finish) {
_disposable.set(this, []);
_disposeHistory.set(this, []);
_state.set(this, void 0);
_label.set(this, void 0);
_Disposer_disposable.set(this, []);
_Disposer_disposeHistory.set(this, []);
_Disposer_state.set(this, void 0);
_Disposer_label.set(this, void 0);
this.logger.setLabel(`Disposer(${label})`);
__classPrivateFieldSet(this, _label, label);
__classPrivateFieldGet(this, _disposable).push(finish);
__classPrivateFieldSet(this, _Disposer_label, label, "f");
__classPrivateFieldGet(this, _Disposer_disposable, "f").push(finish);
}
get label() {
return __classPrivateFieldGet(this, _label);
return __classPrivateFieldGet(this, _Disposer_label, "f");
}
get disposed() {
return !!__classPrivateFieldGet(this, _state);
return !!__classPrivateFieldGet(this, _Disposer_state, "f");
}
get history() {
return __classPrivateFieldGet(this, _disposeHistory);
return __classPrivateFieldGet(this, _Disposer_disposeHistory, "f");
}

@@ -54,10 +52,10 @@ attach(disposable) {

}
__classPrivateFieldGet(this, _disposable).push(disposable);
__classPrivateFieldGet(this, _Disposer_disposable, "f").push(disposable);
}
dispose() {
if (__classPrivateFieldGet(this, _state)) {
return __classPrivateFieldGet(this, _state);
if (__classPrivateFieldGet(this, _Disposer_state, "f")) {
return __classPrivateFieldGet(this, _Disposer_state, "f");
}
this.logger.debug("dispose", this.label);
__classPrivateFieldSet(this, _state, util_1.AsyncState.acquire());
__classPrivateFieldSet(this, _Disposer_state, util_1.AsyncState.acquire(), "f");
return this.disposeAll();

@@ -67,4 +65,4 @@ }

var _a, _b;
while (__classPrivateFieldGet(this, _disposable).length > 0) {
for (const disposable of __classPrivateFieldGet(this, _disposable).splice(0).reverse()) {
while (__classPrivateFieldGet(this, _Disposer_disposable, "f").length > 0) {
for (const disposable of __classPrivateFieldGet(this, _Disposer_disposable, "f").splice(0).reverse()) {
const date = new Date();

@@ -76,14 +74,14 @@ const target = (_b = (_a = disposable === null || disposable === void 0 ? void 0 : disposable.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "Unknown";

this.logger.debug("dispose", { label, target, date, timeout: Date.now() - date.getTime() });
__classPrivateFieldGet(this, _disposeHistory).push({ label, target, date, timeout: Date.now() - date.getTime() });
__classPrivateFieldGet(this, _Disposer_disposeHistory, "f").push({ label, target, date, timeout: Date.now() - date.getTime() });
}
catch (error) {
this.logger.warning("dispose", { target, error, date, timeout: Date.now() - date.getTime() });
__classPrivateFieldGet(this, _disposeHistory).push({ label, target, error, date, timeout: Date.now() - date.getTime() });
__classPrivateFieldGet(this, _Disposer_disposeHistory, "f").push({ label, target, error, date, timeout: Date.now() - date.getTime() });
}
}
}
util_1.AsyncState.resolve(__classPrivateFieldGet(this, _state));
util_1.AsyncState.resolve(__classPrivateFieldGet(this, _Disposer_state, "f"));
}
}
_disposable = new WeakMap(), _disposeHistory = new WeakMap(), _state = new WeakMap(), _label = new WeakMap();
_Disposer_disposable = new WeakMap(), _Disposer_disposeHistory = new WeakMap(), _Disposer_state = new WeakMap(), _Disposer_label = new WeakMap();
__decorate([

@@ -90,0 +88,0 @@ util_1.logger

"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _map;
var _EnvReader_map;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -21,5 +19,5 @@ exports.EnvReader = void 0;

constructor(config) {
_map.set(this, void 0);
__classPrivateFieldSet(this, _map, new Map(Object.entries(config)
.map(([k, v]) => [k, v || ""])));
_EnvReader_map.set(this, void 0);
__classPrivateFieldSet(this, _EnvReader_map, new Map(Object.entries(config)
.map(([k, v]) => [k, v || ""])), "f");
}

@@ -33,3 +31,3 @@ static from(target, ...envs) {

ensure(key, parse) {
const value = __classPrivateFieldGet(this, _map).get(key);
const value = __classPrivateFieldGet(this, _EnvReader_map, "f").get(key);
util_1.assert(value, `The ${key} property should be defined`);

@@ -39,6 +37,6 @@ return util_1.isFunction(parse) ? parse(value) : value;

has(key) {
return __classPrivateFieldGet(this, _map).has(key);
return __classPrivateFieldGet(this, _EnvReader_map, "f").has(key);
}
get(key, opt) {
const value = __classPrivateFieldGet(this, _map).get(key);
const value = __classPrivateFieldGet(this, _EnvReader_map, "f").get(key);
if (util_1.isDefined(value) && util_1.isFunction(opt)) {

@@ -51,3 +49,3 @@ return opt(value);

exports.EnvReader = EnvReader;
_map = new WeakMap();
_EnvReader_map = new WeakMap();
//# sourceMappingURL=EnvReader.js.map

@@ -8,16 +8,14 @@ "use strict";

};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _pending;
var _Heartbeat_pending;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -30,5 +28,5 @@ exports.Heartbeat = void 0;

constructor(label, disposer) {
_pending.set(this, void 0);
_Heartbeat_pending.set(this, void 0);
this.logger.debug("create", { label });
__classPrivateFieldSet(this, _pending, util_1.AsyncState.acquire());
__classPrivateFieldSet(this, _Heartbeat_pending, util_1.AsyncState.acquire(), "f");
if (disposer) {

@@ -39,3 +37,3 @@ disposer((error) => this.destroy(error));

get beats() {
return !util_1.AsyncState.isReleased(__classPrivateFieldGet(this, _pending));
return !util_1.AsyncState.isReleased(__classPrivateFieldGet(this, _Heartbeat_pending, "f"));
}

@@ -71,11 +69,11 @@ /**

if (error) {
return util_1.AsyncState.reject(__classPrivateFieldGet(this, _pending), error);
return util_1.AsyncState.reject(__classPrivateFieldGet(this, _Heartbeat_pending, "f"), error);
}
util_1.AsyncState.resolve(__classPrivateFieldGet(this, _pending));
util_1.AsyncState.resolve(__classPrivateFieldGet(this, _Heartbeat_pending, "f"));
}
watch() {
return __classPrivateFieldGet(this, _pending);
return __classPrivateFieldGet(this, _Heartbeat_pending, "f");
}
}
_pending = new WeakMap();
_Heartbeat_pending = new WeakMap();
__decorate([

@@ -82,0 +80,0 @@ util_1.logger

@@ -56,4 +56,7 @@ "use strict";

this.logger.info("dispose");
await Dispose_1.Disposable.disposeAll();
process.exit(0);
process.nextTick(async () => {
this.logger.info("dispose all");
await Dispose_1.Disposable.disposeAll()
.finally(() => process.exit(0));
});
}

@@ -74,3 +77,3 @@ async watch(chain) {

}
Dispose_1.dispose(this);
await Dispose_1.dispose(this);
}

@@ -77,0 +80,0 @@ async handle(result) {

@@ -8,16 +8,14 @@ "use strict";

};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _context, _registry;
var _Unit_context, _Unit_registry;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -29,9 +27,9 @@ exports.unit = exports.Unit = void 0;

constructor(context, actions = []) {
_context.set(this, void 0);
_registry.set(this, new WeakSet());
__classPrivateFieldSet(this, _context, context);
_Unit_context.set(this, void 0);
_Unit_registry.set(this, new WeakSet());
__classPrivateFieldSet(this, _Unit_context, context, "f");
this.add(...actions);
}
get context() {
return __classPrivateFieldGet(this, _context);
return __classPrivateFieldGet(this, _Unit_context, "f");
}

@@ -55,4 +53,4 @@ static from(context, actions = []) {

util_1.fails(util_1.isUndefined(ctor), "Wrong the Action type");
if (!__classPrivateFieldGet(this, _registry).has(ctor)) {
__classPrivateFieldGet(this, _registry).add(ctor);
if (!__classPrivateFieldGet(this, _Unit_registry, "f").has(ctor)) {
__classPrivateFieldGet(this, _Unit_registry, "f").add(ctor);
added.push(ctor);

@@ -67,4 +65,4 @@ }

util_1.fails(util_1.isUndefined(ctor), "Wrong the Action type");
if (__classPrivateFieldGet(this, _registry).has(ctor)) {
__classPrivateFieldGet(this, _registry).delete(ctor);
if (__classPrivateFieldGet(this, _Unit_registry, "f").has(ctor)) {
__classPrivateFieldGet(this, _Unit_registry, "f").delete(ctor);
removed.push(ctor);

@@ -76,3 +74,3 @@ }

has(action) {
return __classPrivateFieldGet(this, _registry).has(action);
return __classPrivateFieldGet(this, _Unit_registry, "f").has(action);
}

@@ -82,8 +80,8 @@ async run(ctor, state) {

util_1.assert(util_1.isClass(ctor), "Wrong the Action type");
util_1.assert(__classPrivateFieldGet(this, _registry).has(ctor), `Unknown action ${ctor.name}`);
const action = new ctor(__classPrivateFieldGet(this, _context), state);
util_1.assert(__classPrivateFieldGet(this, _Unit_registry, "f").has(ctor), `Unknown action ${ctor.name}`);
const action = new ctor(__classPrivateFieldGet(this, _Unit_context, "f"), state);
return Promise.resolve(action.run()).finally(finish);
}
}
_context = new WeakMap(), _registry = new WeakMap();
_Unit_context = new WeakMap(), _Unit_registry = new WeakMap();
__decorate([

@@ -90,0 +88,0 @@ util_1.logger

{
"name": "@bunt/unit",
"version": "0.19.1",
"version": "0.19.2",
"keywords": [

@@ -29,6 +29,6 @@ "typescript"

"dependencies": {
"@bunt/util": "^0.19.0"
"@bunt/util": "^0.19.2"
},
"license": "MIT",
"gitHead": "a692c96ce4a9e62d97635d280de51a611b8d5bb6"
"gitHead": "6d173b2cfe84a19694499492467ddd19931f9b97"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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